Git相关规范管理工具
1.前提#
已安装pnpm
2.安装husky#
🐶 husky | 🐶 husky (typicode.github.io)
- pnpm install husky –save-dev
- npx husky install
- 在package.json中添加
"scripts": {
"prepare": "husky install",
},
3.安装commitlint#
commitlint - Lint commit messages
- pnpm add @commitlint/cli @commitlint/config-conventional -D
- 在项目根目录下添加配置文件commitlint.config.js
touch commitlint.config.js
// commitlint.config.js
module.exports = {
extends: ["@commitlint/config-conventional"],
};
4.安装release-it#
- pnpm add release-it @release-it/conventional-changelog -D
- 在项目根目录下添加 .release-it.json
touch .release-it.json
//.release-it.json
{
"plugins": {
"@release-it/conventional-changelog": {
"preset": "angular",
"infile": "CHANGELOG.md"
}
},
"git": {
"commitMessage": "chore: release v${version}",
"push": false,
"requireUpstream": false
},
"github": {
"release": false,
"draft": false
},
"npm": {
"publish": false
}
} - 在package.json添加
{
"scripts": {
"release": "release-it"
}
} - pnpm release
5.reference#
https://zhuanlan.zhihu.com/p/396636794
https://zhuanlan.zhihu.com/p/619659218
https://www.conventionalcommits.org/zh-hans/v1.0.0/
https://www.cnblogs.com/linhuiy/p/15896611.html
约定式提交 (conventionalcommits.org)
Commit Message 规范 - 她微笑的脸 - 博客园 (cnblogs.com)