build(git): .githooks补一个 commit-msg + commitlint

This commit is contained in:
sophie committed 2026-06-08 14:07:40 +08:00
1 parent c7f25ec8a1
commit 6057069c1c
9 files changed
+157 -12

No files matched your search

+12 -4
View File
@@ -167,11 +167,19 @@ revert: feat(payment): support WeChat QR checkout
- 是否存在破坏性变更,若有是否标注 `BREAKING CHANGE`?
- 是否关联了任务编号(`Refs/Closes #id`)?
## 12. 推荐工具(落地执行)
## 12. 自动化校验(已启用)
- `commitlint`:校验提交信息格式。
- `husky`:在 `commit-msg` 钩子自动校验。
- 可选:`commitizen` 或 `cz-git` 提供交互式提交,降低学习成本。
仓库已通过 Git Hook 自动校验提交信息,配置如下:
- **commitlint**:根目录 `commitlint.config.cjs`,规则与本文档对齐。
- **commit-msg Hook**:`.githooks/commit-msg`,在 `git commit` 时自动运行。
- **安装**:`./scripts/install_git_hooks.sh`(会设置 `core.hooksPath` 并执行根目录 `npm install`)。
详见 [Git Hooks 团队启用指南](../GIT_HOOKS.md)。
可选工具(尚未配置,可按需引入):
- `commitizen` 或 `cz-git`:交互式提交,降低学习成本。
- 参考链接:https://www.conventionalcommits.org/en/v1.0.0/
---