规范提交
web | des |
---|---|
约定式提交规范 | |
commitizen |
package.json
json
"config": {
"commit": {
"path": "./node_modules/cz-customizable"
}
}
.cz-config.js
js
module.exports = {
types: [
{ value: 'feat', name: 'feat: 新功能' },
{ value: 'fix', name: 'fix: 修复bug' },
{ value: 'docs', name: 'docs: 文档更新' },
{ value: 'style', name: 'style: 代码格式(不影响代码运行的变动)' },
{ value: 'refactor', name: 'refactor: 重构(即不是新增功能,也不是修改bug的代码变动)' },
{ value: 'perf', name: 'perf: 性能优化' },
{ value: 'test', name: 'test: 增加测试' },
{ value: 'build', name: 'build: 构建过程或辅助工具的变动' },
{ value: 'ci', name: 'ci: 持续集成' },
{ value: 'chore', name: 'chore: 构建过程或辅助工具的变动' },
{ value: 'revert', name: 'revert: 回滚到上一个版本' },
{ value: 'WIP', name: 'WIP: 开发中' },
],
messages: {
type: '请选择提交类型:',
customScope: '请输入自定义的提交范围(可选):',
subject: '请简要描述提交(必填):',
body: '请输入详细描述(可选):',
footer: '请列出任何关闭的issue(可选):',
comfirmCommit: '确认提交?',
},
skipQuestions: ['body', 'footer'],
subjectLimit: 100,
}
提交
sh
git add .
git cz
git-hooks
sh
npm i -D @commitlint/config-conventional @commitlint/cli
package.json 中scripts加入"prepare": "husky install"