CONFIGURED - Auto-activate git hooks via npm prepare script
Add a prepare script that runs 'git config core.hooksPath .githooks' on every npm install, so the commit-msg style gate and pre-push test gate turn on automatically per clone with nothing to remember. Guarded with '|| true' so installs never fail where git is absent (e.g. tarball deploys). Document that the deploy server never needs it since it only pulls.
This commit is contained in:
@@ -150,5 +150,8 @@ Do **not** add any `Co-Authored-By` / "Generated with Claude Code" attribution
|
|||||||
lines to commits in this repo. Write the body (when useful) as wrapped prose or
|
lines to commits in this repo. Write the body (when useful) as wrapped prose or
|
||||||
bullet points explaining the *why*, matching the existing history.
|
bullet points explaining the *why*, matching the existing history.
|
||||||
|
|
||||||
The hook and the test gate are activated per clone with:
|
The hook (and the `pre-push` test gate) live in `.githooks/` and are activated
|
||||||
`git config core.hooksPath .githooks` (emergency skip: `git commit --no-verify`).
|
per clone via `core.hooksPath`. You don't need to remember this: the `prepare`
|
||||||
|
npm script runs `git config core.hooksPath .githooks` automatically on every
|
||||||
|
`npm install`. The deploy server does not need it — it only pulls, never commits
|
||||||
|
or pushes, so no hook ever fires there. Emergency skip: `git commit --no-verify`.
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"prepare": "git config core.hooksPath .githooks || true",
|
||||||
"dev": "next dev -p 3014",
|
"dev": "next dev -p 3014",
|
||||||
"build": "next build --webpack",
|
"build": "next build --webpack",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
|
|||||||
Reference in New Issue
Block a user