commitlint提交规范

更新时间:2023-05-16 20:07:03 阅读: 评论:0

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

本文发布于:2023-05-16 20:07:03,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/111051.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:代码   提交   冒号   添加   变动
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图