Skip to content

Commit

Permalink
feature: 添加手选规范提交
Browse files Browse the repository at this point in the history
  • Loading branch information
jsxiaosi committed Mar 6, 2022
1 parent 04bafdf commit 10df4f9
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
48 changes: 48 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* feature
* fixbug 修复
* refactor:重构代码(既没有新增功能,也没有修复 bug)
* docs:文档更新
* style:不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)
* perf:性能, 体验优化
* chore:不属于以上类型的其他类型,比如构建流程, 依赖管理
* revert:回滚某个更早之前的提交
*/

module.exports = {
// 可选类型
types: [
{ emoji: '🚀', value: 'feature', name: 'feature: 新功能' },
{ emoji: '🐛', value: 'fixbug', name: 'fixbug: 修复' },
{ emoji: '📝', value: 'docs', name: 'docs: 文档变更' },
{
emoji: '💅',
value: 'style',
name: 'style: 不影响程序逻辑的代码修改(修改空白字符,格式缩进,补全缺失的分号等,没有改变代码逻辑)',
},
{ emoji: '🔍', value: 'refactor', name: 'refactor: 重构(既不是增加feature),也不是修复bug' },
{ emoji: '💡', value: 'pref', name: 'pref: 性能优化' },
{
emoji: '🤖',
value: 'chore',
name: 'chore: 不属于以上类型的其他类型,比如构建流程, 依赖管理',
},
{ emoji: '⏪', value: 'revert', name: 'revert: 回退' },
],

// 步骤
messages: {
type: '请选择提交的类型;',
customScope: '请输入修改的范围(可选)',
subject: '请简要描述提交(必填)',
body: '请输入详细描述(可选)',
footer: '请选择要关闭的issue(可选)',
confirmCommit: '确认要使用以上信息提交?(y/n)',
},

// 跳过步骤
skipQuestions: ['customScope', 'body', 'footer'],

// 默认长度
subjectLimit: 100,
};
27 changes: 25 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
"lint:pretty": "pretty-quick --staged",
"lint:staged": "lint-staged",
"commit": "git-cz",
"prepare": "husky install",
"push": "scp -r dist/* root@服务器公网IP:/服务器资源存放地址",
"build:push": "npm run build && npm run push"
Expand Down Expand Up @@ -65,6 +66,7 @@
"babel-eslint": "^10.1.0",
"commitizen": "^4.2.4",
"cz-conventional-changelog": "^3.3.0",
"cz-customizable": "^6.3.0",
"eslint": "^8.10.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.25.4",
Expand Down Expand Up @@ -99,10 +101,31 @@
"license": "MIT",
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
"path": "./node_modules/cz-customizable"
}
},
"lint-staged": {
"*.vue": "eslint \"{src,mock}/**/*.{vue}\""
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [
"prettier --write--parser json"
],
"package.json": [
"prettier --write"
],
"*.vue": [
"eslint --fix",
"prettier --write",
"stylelint --fix"
],
"*.{scss,less,styl,html}": [
"stylelint --fix",
"prettier --write"
],
"*.md": [
"prettier --write"
]
}
}

0 comments on commit 10df4f9

Please sign in to comment.