chore(githooks): rename hooks dir to .githooks and stop old next processes

Move repository-managed git hooks from `git_hooks/` to `.githooks/` to follow the conventional hidden-directory naming, and add a graceful shutdown step in `post-receive` that terminates any running `next start` / `next-server` processes (SIGTERM → wait 2s → SIGKILL → wait 1s) before relaunching, avoiding EADDRINUSE port conflicts so the freshly built code actually takes effect. README updated to reference the new path.
This commit is contained in:
2026-06-12 18:24:08 +08:00
parent 8afcc40b9c
commit 546e5f4b3d
2 changed files with 18 additions and 3 deletions
+3 -3
View File
@@ -22,10 +22,10 @@ This project uses [`next/font`](https://nextjs.org/docs/app/building-your-applic
## Git Hooks
项目使用 `git_hooks/` 目录存放**仓库内**的 git hooks**不**在 `.git/hooks/`)。**clone 后需手动启用**
项目使用 `.githooks/` 目录存放**仓库内**的 git hooks**不**在 `.git/hooks/`)。**clone 后需手动启用**
```bash
git config core.hooksPath git_hooks
git config core.hooksPath .githooks
```
### 启用的 Hook
@@ -38,7 +38,7 @@ git config core.hooksPath git_hooks
**注意事项**
- 本仓库的 `git_hooks/post-receive` **不**会**自动**生效 —— 必须在每个工作副本上跑一次上面的 `git config` 命令
- 本仓库的 `.githooks/post-receive` **不**会**自动**生效 —— 必须在每个工作副本上跑一次上面的 `git config` 命令
- `core.hooksPath` 是**本地** git config(写入 `.git/config`),**不**随仓库提交
- `post-receive` 在**接收端**触发 —— 即 push 目标机器(生产 / 测试服务器)的 hook,不是本地开发机的