Skip to content

Commit

Permalink
chore: npx @luozhu/create-commitlint
Browse files Browse the repository at this point in the history
  • Loading branch information
洛竹 committed Aug 11, 2021
1 parent 38ef6b9 commit 4bde907
Show file tree
Hide file tree
Showing 4 changed files with 1,023 additions and 20 deletions.
69 changes: 69 additions & 0 deletions .cz-config.js
@@ -0,0 +1,69 @@
module.exports = {
types: [
{
value: 'feat',
name: 'feat: 新功能',
},
{
value: 'fix',
name: 'fix: 修复Bug',
},
{
value: 'docs',
name: 'docs: 文档变动',
},
{
value: 'style',
name: 'style: 不影响代码含义的变化(空白、格式化、缺少分号等)',
},
{
value: 'refactor',
name: 'refactor: 重构代码,既不修复错误也不添加功能',
},
{
value: 'perf',
name: 'perf: 性能优化',
},
{
value: 'test',
name: 'test: 测试相关',
},
{
value: 'build',
name: 'build: 影响构建系统或外部依赖关系的更改',
},
{
value: 'ci',
name: 'ci: 更改持续集成文件和脚本',
},
{
value: 'chore',
name: 'chore: 重新打包或更新依赖工具等杂活',
},
{
value: 'revert',
name: 'revert: Revert to a commit',
},
{
value: 'wip',
name: 'wip: Work in progress',
},
],
// override the messages, defaults are as follows
messages: {
type: '请选择 Commit 类型:',
scope: '请选择影响范围 (Scope) (可选):',
customScope: '请选择影响范围 (Scope) (可选):',
subject: '请提供一段简要的 Commit 信息:\n',
body: '请提供一段详细的信息来描述此次更改 (可选). 使用 "|" 来另起一行:\n',
breaking: '是否有任何 BREAKING CHANGES (可选):\n',
footer: '是否有任何 ISSUE 可以被此次 Commit 关闭 (可选). E.g.: #31, #34:\n',
confirmCommit: '是否确认提交上述 Commit 信息?',
},

allowCustomScopes: true,
allowBreakingChanges: ['feat', 'fix', 'refactor'],

// limit subject length
subjectLimit: 100,
};
8 changes: 8 additions & 0 deletions commitlint.config.js
@@ -0,0 +1,8 @@
module.exports = {
extends: ['cz'],
rules: {
// must add these rules
'type-empty': [2, 'never'],
'subject-empty': [2, 'never'],
},
};
15 changes: 13 additions & 2 deletions package.json
Expand Up @@ -27,10 +27,17 @@
"watch": "tsc -watch -p ./",
"pretest": "yarn run compile && yarn run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
"test": "node ./out/test/runTest.js",
"commit": "git cz"
},
"config": {
"commitizen": {
"path": "cz-customizable"
}
},
"gitHooks": {
"pre-commit": "lint-staged"
"pre-commit": "lint-staged",
"commit-msg": "commitlint -e -V"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
Expand All @@ -41,6 +48,7 @@
]
},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
"@luozhu/eslint-config-typescript": "^1.8.1",
"@luozhu/prettier-config": "^1.0.3",
"@types/glob": "^7.1.3",
Expand All @@ -49,6 +57,9 @@
"@types/vscode": "^1.59.0",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"commitizen": "^4.2.4",
"commitlint-config-cz": "^0.13.2",
"cz-customizable": "^6.3.0",
"eslint": "^7.19.0",
"glob": "^7.1.6",
"lint-staged": "^11.1.2",
Expand Down

0 comments on commit 4bde907

Please sign in to comment.