1.安装cz-conventional-changelog-zh
npm i cz-conventional-changelog-zh
2.package.json中配置
scripts中
"scripts": {
"commit": "git-cz"
},
commitizen中配置
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog-zh",
"disableScopeLowerCase": false,
"disableSubjectLowerCase": false,
"maxHeaderWidth": "header-max-length",
"maxLineWidth": 100,
"defaultType": "",
"defaultScope": "",
"defaultSubject": "",
"defaultBody": "",
"defaultIssues": "",
"types": {
"feat": {
"description": "一个新功能",
"title": "Features"
},
"fix": {
"description": "一个bug",
"title": "Bug Fixes"
},
"docs": {
"description": "文档增删改",
"title": "Documentation"
},
"style": {
"description": "样式修改(空白、格式、缺少分号等)",
"title": "Styles"
},
"refactor": {
"description": "既不修复bug也不添加新功能的更改",
"title": "Code Refactoring"
},
"perf": {
"description": "性能优化",
"title": "Performance Improvements"
},
"test": {
"description": "增加测试",
"title": "Tests"
},
"build": {
"description": "影响构建系统或外部依赖项的更改(示例范围:gulp、broccoli、npm)",
"title": "Builds"
},
"ci": {
"description": "对CI配置文件和脚本的更改(示例范围:Travis, Circle, BrowserStack, SauceLabs)",
"title": "Continuous Integrations"
},
"chore": {
"description": "除src目录或测试文件以外的修改",
"title": "Chores"
},
"revert": {
"description": "回退历史版本",
"title": "Reverts"
},
"conflict": {
"description": "修改冲突",
"title": "Conflict"
},
"font": {
"description": "字体文件更新",
"title": "Fonts"
},
"delete": {
"description": "删除文件",
"title": "Delete Files"
},
"stash": {
"description": "暂存文件",
"title": "Stash Files"
}
}
}
}
最后在提交代码的时候,执行git cz
即可出现
选择即可
详情解说地址:https://github.com/z649319834/cz-conventional-changelog-zh