commitlint提交规范
⽬前项⽬提交信息写的⽐较随意 只能看到开发⼈员每次备注的信息 为了后期协作以及处理Bug时会更加⽅便 引⼊commit规范,每次commit时,commitlint会⽤在git的hook回调中,最简单的就是和 husky⼀起使⽤
spcccommit message: <type>: <subject> (注意冒号后⾯有空格)
type:
overhead costfeat:新功能(feature)
fix:修补bug
docs:⽂档(documentation)
healthier
style: 格式(不影响代码运⾏的变动)
refactor:重构(即不是新增功能,也不是修改bug的代码变动)
test:增加测试
chore:构建过程或辅助⼯具的变动
upgrade: 第三⽅库升级
suntrevert:回滚
subject:
basic是什么意思
subject是 commit ⽬的的简短描述
实现步骤
1 安装commitlint库
cnpm install @commitlint/cli @commitlint/config-conventional
气门结构2 在fig.js(在项⽬根⽬录创建)制定提交message规范,其中rules可以⾃定义添加⼀些规则
extends: ['@commitlint/config-conventional'],
清潭洞爱丽丝片尾曲
rules: {
'type-enum': [2, 'always', [
"feat", "fix", "docs", "style", "refactor", "test", "chore", "revert" , "upgrade","revert","build"
firebat]],
'subject-full-stop': [0, 'never'],
'subject-ca': [0, 'never']
}
}
cnpm install husky --save-dev
package.json⾥添加配置(与dependencies并列)
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
}
绯闻女孩第六季下载
eg: git commit -m "feat: 增加****列表"finefood