docs: update git hooks documentation from githooks to husky

This commit is contained in:
pnoker
2026-06-29 16:41:20 +08:00
parent a78da8fc60
commit aa34de64a6
2 changed files with 7 additions and 19 deletions
+5 -11
View File
@@ -95,10 +95,10 @@ iot-dc3/
│ ├── docker-compose-dev.yml # Development overrides
│ ├── docker-compose-optional.yml # Optional monitoring/messaging
│ ├── env/dev.env # IDE-friendly local env vars
│ └── bin/ # changelog.py, commit_msg_lint.py, tag.sh
│ └── bin/ # changelog.py, tag.sh
├── docs/ # VitePress documentation site
├── Makefile # Preferred command entrypoint
├── .githooks/commit-msg # Conventional commit validation hook
├── .husky/ # Git hooks (pre-commit runs lint-staged)
└── .mvn/settings.xml # Local Maven mirror (mainland China)
```
@@ -159,7 +159,6 @@ make up-optional
make up-db && make up-optional && make up-dev
make package
make changelog
make install-hooks
```
Direct Maven commands should use the checked-in settings file for local development:
@@ -493,14 +492,9 @@ Rules:
- Use `!` for breaking changes and explain the impact in the body.
- For release-note-only commits, use exactly `docs(release): update generated changelog`.
Install local commit validation:
```bash
make install-hooks
```
The hook checks commit subjects before `git commit` completes. It is a local Git mechanism; CI or branch protection
should run the same script for server-side enforcement if needed.
Husky manages Git hooks automatically — no manual install needed. The `pre-commit` hook runs lint-staged (eslint +
prettier) on staged files before each commit. A `commit-msg` hook stub exists (`.husky/_/commit-msg`) but has no
validation script attached yet; to enforce conventional-commit format, add a script at `.husky/commit-msg`.
## Testing
+2 -8
View File
@@ -70,14 +70,8 @@ Allowed types are `feat`, `fix`, `perf`, `refactor`, `docs`, `build`, `ci`, `tes
`revert`. Use English, keep the subject specific, and avoid vague descriptions such as `update`, `fix`, `misc`, `wip`,
or `.` because release notes are generated from commit history.
Install the local commit-message hook before contributing:
```bash
make install-hooks
```
The hook validates the commit subject during `git commit`. It is intentionally strict because `dc3/doc/CHANGE.md` is
generated from commit messages.
Husky Git hooks are pre-installed in the repository (`.husky/`). The `pre-commit` hook automatically runs lint-staged
(eslint + prettier) on staged files before each commit. No manual setup is needed.
## Build and Verification