项目配置:commitizen工具使用

提交代码前规范git commit的风格来进行提交,这样可以快速定位每次提交的内容,方便之后对版本进行控制。

  1. 安装commitizen

npm install commitizen -D
  1. 安装cz-conventional-changelog,并且初始化cz-conventional-changelog:

npx commitizen init cz-conventional-changelog --save-dev --save-exact
  1. 在package.json中进行配置

  1. 提交代码时需要执行npx cz

npx cz

Type

作用

feat

新增特性 (feature)

fix

修复 Bug(bug fix)

docs

修改文档 (documentation)

style

代码格式修改(white-space, formatting, missing semi colons, etc)

refactor

代码重构(refactor)

perf

改善性能(A code change that improves performance)

test

测试(when adding missing tests)

build

变更项目构建或外部依赖(例如 scopes: webpack、gulp、npm 等)

ci

更改持续集成软件的配置文件和 package 中的 scripts 命令,例如 scopes: Travis, Circle 等

chore

变更构建流程或辅助工具(比如更改测试环境)

revert

代码回退

之后按提示完成即可

附:

限制原始git commit方式提交

1.安装 @commitlint/config-conventional 和 @commitlint/cli

npm i @commitlint/config-conventional @commitlint/cli -D

2.在根目录创建commitlint.config.js文件,配置commitlint

module.exports = {
  extends: ['@commitlint/config-conventional']
}

3.执行以下命令,使用husky生成commit-msg文件,验证提交信息:

npx husky add .husky/commit-msg "npx --no-install commitlint --edit $1"

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值