代码提交commitzen

官网:https://haomo-tech.com

作者:胡小根

邮箱:hxg@haomo-studio.com

1. 安装和使用

npm install commitizen -g
# 在项目中配置
commitizen init cz-conventional-changelog --save-dev --save-exact
npm install -D husky @commitlint/config-conventional @commitlint/cli

在package.json中添加配置

{
    "config": {
        "commitizen": {
            "path": "./node_modules/cz-conventional-changelog"
        }
    },
    "husky": {
        "hooks": {
            "commit-msg": "commitlint -x @commitlint/config-conventional -E HUSKY_GIT_PARAMS"
        }
    }
}

提交message要求:

feat:新功能(feature)
fix:修补bug
docs:文档(documentation)
style: 格式(不影响代码运行的变动)
refactor:重构(即不是新增功能,也不是修改bug的代码变动)
test:增加测试
chore:构建过程或辅助工具的变动

results matching ""

    No results matching ""