-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommitlint.config.cjs
124 lines (120 loc) · 2.85 KB
/
commitlint.config.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// https://cz-git.qbb.sh/zh/guide/
// https://commitlint.js.org/#/reference-rules
const fs = require("fs");
const path = require("path");
const scopes = fs
.readdirSync(path.resolve(__dirname, "src"), { withFileTypes: true })
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name.replace(/s$/, ""));
/** @type {import('cz-git').UserConfig} */
module.exports = {
ignores: [commit => commit.includes("init")],
extends: ["@commitlint/config-conventional"],
rules: {
"body-leading-blank": [2, "always"],
"footer-leading-blank": [1, "always"],
"header-max-length": [2, "always", 108],
"subject-empty": [2, "never"],
"type-empty": [2, "never"],
"subject-case": [0],
"type-enum": [
2,
"always",
[
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert",
"wip",
"workflow",
"types",
"release"
]
]
},
prompt: {
messages: {
type: "你要提交的类型:",
scope: "提交范围:",
customScope: "自定义提交范围:",
subject: "变更描述:\n",
body: "详细的变更描述('|'换行):\n",
breaking: "重大的变更('|'换行):\n",
footerPrefixsSelect: "关联的issue前缀:",
customFooterPrefixs: "自定义issue前缀:",
footer: "列举关联的issue(#1, #2):\n",
confirmCommit: "是否提交或修改commit?"
},
types: [
{
value: "feat",
name: "feat:新增功能"
},
{
value: "fix",
name: "fix:修复问题"
},
{
value: "style",
name: "style:代码格式(不影响代码运行的变动)"
},
{
value: "type",
name: "type:类型修改"
},
{
value: "test",
name: "test:新增测试"
},
{
value: "docs",
name: "docs:文档变更"
},
{
value: "wip",
name: "wip:开发中"
},
{
value: "perf",
name: "perf:性能优化"
},
{
value: "refactor",
name: "refactor:重构"
},
{
value: "chore",
name: "chore:构建过程或辅助工具的变动"
},
{
value: "build",
name: "build:编译/打包配置相关"
},
{
value: "revert",
name: "revert:撤销修改/回滚"
},
{
value: "workflow",
name: "workflow:工作流修改"
},
{
value: "ci",
name: "ci:持续集成"
}
],
useEmoji: true,
scopes: [...scopes],
customScopesAlign: "bottom",
emptyScopesAlias: "empty",
customScopesAlias: "custom",
allowBreakingChanges: ["feat", "fix"]
}
};