standards-cli 1.0.3 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -28
- package/package.json +23 -2
- package/src/commands/init.js +58 -28
- package/templates/commitlint/config.cjs +30 -18
- package/templates/husky/commit-msg.sh +1 -9
- package/templates/husky/pre-commit.sh +0 -9
- package/templates/lint-staged/config.cjs +2 -9
- package/templates/commitlint/cz.config.cjs +0 -45
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ standards init [选项]
|
|
|
107
107
|
```json
|
|
108
108
|
{
|
|
109
109
|
"scripts": {
|
|
110
|
-
"prepare": "husky
|
|
110
|
+
"prepare": "husky",
|
|
111
111
|
"cz": "cz",
|
|
112
112
|
"commit": "cz"
|
|
113
113
|
},
|
|
@@ -115,6 +115,11 @@ standards init [选项]
|
|
|
115
115
|
"commitizen": {
|
|
116
116
|
"path": "cz-git"
|
|
117
117
|
}
|
|
118
|
+
},
|
|
119
|
+
"pnpm": {
|
|
120
|
+
"overrides": {
|
|
121
|
+
"string-width": "^7.0.0"
|
|
122
|
+
}
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
```
|
|
@@ -132,7 +137,23 @@ standards init [选项]
|
|
|
132
137
|
|
|
133
138
|
初始化完成后,可以使用以下两种方式提交:
|
|
134
139
|
|
|
135
|
-
###
|
|
140
|
+
### 方式一:符合规范格式的直接提交(推荐)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
git commit -m "feat(login): 完成登录相关功能"
|
|
144
|
+
git commit -m "fix(user): 修复用户信息更新bug"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**格式要求:** `type(scope): subject`
|
|
148
|
+
|
|
149
|
+
- `type`: 提交类型(feat/fix/docs 等)
|
|
150
|
+
- `scope`: 模块名称(必填,如 login、user、api 等)
|
|
151
|
+
- `subject`: 简短描述
|
|
152
|
+
|
|
153
|
+
✅ **只要符合格式,就能正常提交**
|
|
154
|
+
❌ **不符合格式会被 commit-msg hook 拦截**
|
|
155
|
+
|
|
156
|
+
### 方式二:交互式提交
|
|
136
157
|
|
|
137
158
|
```bash
|
|
138
159
|
pnpm commit
|
|
@@ -142,24 +163,24 @@ pnpm cz
|
|
|
142
163
|
|
|
143
164
|
使用交互式界面选择提交类型、填写描述等,自动生成符合规范的提交信息。
|
|
144
165
|
|
|
145
|
-
|
|
166
|
+
## 团队成员使用流程
|
|
146
167
|
|
|
147
|
-
|
|
148
|
-
2. **填写 scope(对应代码模块)** - 必填,手动输入如 `auth`
|
|
149
|
-
3. 填写简短描述(subject)- 必填
|
|
150
|
-
4. 确认提交
|
|
151
|
-
|
|
152
|
-
**最终提交信息格式:** `feat (auth): add login feature`
|
|
153
|
-
|
|
154
|
-
### 方式二:直接提交
|
|
168
|
+
团队成员克隆项目后,只需执行:
|
|
155
169
|
|
|
156
170
|
```bash
|
|
157
|
-
|
|
171
|
+
# 1. 安装依赖(会自动执行 prepare 脚本,初始化 Git hooks)
|
|
172
|
+
pnpm install
|
|
173
|
+
|
|
174
|
+
# 2. 之后正常提交即可(符合规范就能提交,不符合会被拦截)
|
|
175
|
+
git commit -m "feat(login): 完成登录相关功能"
|
|
158
176
|
```
|
|
159
177
|
|
|
160
|
-
|
|
178
|
+
**说明:**
|
|
161
179
|
|
|
162
|
-
|
|
180
|
+
- `pnpm install` 会自动触发 `prepare` 脚本
|
|
181
|
+
- `prepare` 脚本执行 `husky`,自动配置 Git hooks
|
|
182
|
+
- 配置完成后,每次 commit 都会自动检查提交信息格式
|
|
183
|
+
- **无需额外操作**,开箱即用
|
|
163
184
|
|
|
164
185
|
## lint-staged 智能配置
|
|
165
186
|
|
|
@@ -219,24 +240,24 @@ CLI 会自动检测项目是否已安装 `eslint` 和 `prettier`,并生成对
|
|
|
219
240
|
**示例:**
|
|
220
241
|
|
|
221
242
|
```bash
|
|
222
|
-
#
|
|
223
|
-
git commit -m "feat
|
|
224
|
-
git commit -m "fix
|
|
225
|
-
git commit -m "docs:
|
|
226
|
-
|
|
227
|
-
#
|
|
228
|
-
git commit -m "add login"
|
|
229
|
-
git commit -m "
|
|
230
|
-
git commit -m "update"
|
|
231
|
-
git commit -m "feat: add login" # 缺少 scope
|
|
243
|
+
# ✅ 正确格式(能提交)
|
|
244
|
+
git commit -m "feat(login): 完成登录相关功能"
|
|
245
|
+
git commit -m "fix(api): 修复接口超时问题"
|
|
246
|
+
git commit -m "docs(readme): 更新文档"
|
|
247
|
+
|
|
248
|
+
# ❌ 错误格式(会被拦截)
|
|
249
|
+
git commit -m "add login" # 缺少 type 和 scope
|
|
250
|
+
git commit -m "feat: add login" # 缺少 scope
|
|
251
|
+
git commit -m "update" # 格式不符合
|
|
232
252
|
```
|
|
233
253
|
|
|
234
254
|
## 注意事项
|
|
235
255
|
|
|
236
|
-
1.
|
|
237
|
-
2.
|
|
238
|
-
3. **
|
|
239
|
-
4.
|
|
256
|
+
1. **团队成员使用**:只需 `pnpm install`,会自动初始化 Git hooks
|
|
257
|
+
2. **提交方式**:`git commit -m "feat(scope): message"` 只要符合格式就能提交
|
|
258
|
+
3. **eslint/prettier 依赖**:本 CLI 不安装 eslint 和 prettier,请根据项目需要自行安装
|
|
259
|
+
4. **lint-staged 配置**:CLI 会自动检测并生成合适的配置
|
|
260
|
+
5. **Node 版本**:需要 Node.js >= 18
|
|
240
261
|
|
|
241
262
|
## 开发
|
|
242
263
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "standards-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "一键初始化前端项目提交规范链路(cz-git + commitlint + husky + lint-staged)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"templates"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"test": "node src/index.js init"
|
|
17
|
+
"test": "node src/index.js init",
|
|
18
|
+
"prepare": "husky || exit 0",
|
|
19
|
+
"cz": "cz",
|
|
20
|
+
"commit": "cz"
|
|
18
21
|
},
|
|
19
22
|
"keywords": [
|
|
20
23
|
"commitlint",
|
|
@@ -38,5 +41,23 @@
|
|
|
38
41
|
},
|
|
39
42
|
"engines": {
|
|
40
43
|
"node": ">=18"
|
|
44
|
+
},
|
|
45
|
+
"config": {
|
|
46
|
+
"commitizen": {
|
|
47
|
+
"path": "cz-git"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"pnpm": {
|
|
51
|
+
"overrides": {
|
|
52
|
+
"string-width": "^7.0.0"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@commitlint/cli": "^20.3.1",
|
|
57
|
+
"@commitlint/config-conventional": "^20.3.1",
|
|
58
|
+
"commitizen": "^4.3.1",
|
|
59
|
+
"cz-git": "^1.12.0",
|
|
60
|
+
"husky": "^9.1.7",
|
|
61
|
+
"lint-staged": "^16.2.7"
|
|
41
62
|
}
|
|
42
63
|
}
|
package/src/commands/init.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import readline from "node:readline/promises";
|
|
2
2
|
import { stdin as input, stdout as output } from "process";
|
|
3
|
+
import { readFileSync } from "fs";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { dirname, join } from "path";
|
|
3
6
|
import {
|
|
4
7
|
exists,
|
|
5
8
|
readJson,
|
|
@@ -18,6 +21,9 @@ import {
|
|
|
18
21
|
} from "../lib/pm.js";
|
|
19
22
|
import { execLive } from "../lib/exec.js";
|
|
20
23
|
|
|
24
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
25
|
+
const __dirname = dirname(__filename);
|
|
26
|
+
|
|
21
27
|
const rl = readline.createInterface({ input, output });
|
|
22
28
|
|
|
23
29
|
/**
|
|
@@ -113,10 +119,24 @@ function hasLintTools(pkg) {
|
|
|
113
119
|
async function generateConfigFiles(pkg) {
|
|
114
120
|
console.log("\n📝 生成配置文件...");
|
|
115
121
|
|
|
122
|
+
// 读取模板文件
|
|
123
|
+
const commitlintConfig = readFileSync(
|
|
124
|
+
join(__dirname, "../../templates/commitlint/config.cjs"),
|
|
125
|
+
"utf-8"
|
|
126
|
+
);
|
|
127
|
+
const lintstagedConfigFull = readFileSync(
|
|
128
|
+
join(__dirname, "../../templates/lint-staged/config.cjs"),
|
|
129
|
+
"utf-8"
|
|
130
|
+
);
|
|
131
|
+
const lintstagedConfigSimple = readFileSync(
|
|
132
|
+
join(__dirname, "../../templates/lint-staged/config-simple.cjs"),
|
|
133
|
+
"utf-8"
|
|
134
|
+
);
|
|
135
|
+
|
|
116
136
|
// commitlint.config.cjs
|
|
117
137
|
const commitlintCreated = await writeFileIfMissing(
|
|
118
138
|
"commitlint.config.cjs",
|
|
119
|
-
|
|
139
|
+
commitlintConfig
|
|
120
140
|
);
|
|
121
141
|
if (commitlintCreated) {
|
|
122
142
|
console.log(" ✔ commitlint.config.cjs");
|
|
@@ -124,25 +144,14 @@ async function generateConfigFiles(pkg) {
|
|
|
124
144
|
console.log(" ⚠ commitlint.config.cjs (已存在,跳过)");
|
|
125
145
|
}
|
|
126
146
|
|
|
127
|
-
// cz.config.cjs
|
|
128
|
-
const czConfigCreated = await writeFileIfMissing(
|
|
129
|
-
"cz.config.cjs",
|
|
130
|
-
`module.exports = require('standards-cli/templates/commitlint/cz.config.cjs');\n`
|
|
131
|
-
);
|
|
132
|
-
if (czConfigCreated) {
|
|
133
|
-
console.log(" ✔ cz.config.cjs");
|
|
134
|
-
} else {
|
|
135
|
-
console.log(" ⚠ cz.config.cjs (已存在,跳过)");
|
|
136
|
-
}
|
|
137
|
-
|
|
138
147
|
// .lintstagedrc.cjs - 根据是否有 eslint/prettier 选择模板
|
|
139
148
|
const hasLintToolsInstalled = hasLintTools(pkg);
|
|
140
|
-
const
|
|
141
|
-
?
|
|
142
|
-
:
|
|
149
|
+
const lintstagedContent = hasLintToolsInstalled
|
|
150
|
+
? lintstagedConfigFull
|
|
151
|
+
: lintstagedConfigSimple;
|
|
143
152
|
const lintstagedrcCreated = await writeFileIfMissing(
|
|
144
153
|
".lintstagedrc.cjs",
|
|
145
|
-
|
|
154
|
+
lintstagedContent
|
|
146
155
|
);
|
|
147
156
|
if (lintstagedrcCreated) {
|
|
148
157
|
console.log(" ✔ .lintstagedrc.cjs");
|
|
@@ -155,7 +164,6 @@ async function generateConfigFiles(pkg) {
|
|
|
155
164
|
|
|
156
165
|
// .husky/pre-commit
|
|
157
166
|
const preCommitContent = `#!/bin/sh
|
|
158
|
-
. "$(dirname "$0")/_/husky.sh"
|
|
159
167
|
npx --no-install lint-staged
|
|
160
168
|
`;
|
|
161
169
|
await writeFile(".husky/pre-commit", preCommitContent);
|
|
@@ -164,7 +172,6 @@ npx --no-install lint-staged
|
|
|
164
172
|
|
|
165
173
|
// .husky/commit-msg
|
|
166
174
|
const commitMsgContent = `#!/bin/sh
|
|
167
|
-
. "$(dirname "$0")/_/husky.sh"
|
|
168
175
|
npx --no-install commitlint --edit "$1"
|
|
169
176
|
`;
|
|
170
177
|
await writeFile(".husky/commit-msg", commitMsgContent);
|
|
@@ -189,8 +196,12 @@ async function updatePackageJson() {
|
|
|
189
196
|
|
|
190
197
|
// 添加 prepare(如果不存在)
|
|
191
198
|
if (!pkg.scripts.prepare) {
|
|
192
|
-
pkg.scripts.prepare = "husky
|
|
193
|
-
console.log(' ✔ 添加 scripts.prepare = "husky
|
|
199
|
+
pkg.scripts.prepare = "husky";
|
|
200
|
+
console.log(' ✔ 添加 scripts.prepare = "husky"');
|
|
201
|
+
modified = true;
|
|
202
|
+
} else if (pkg.scripts.prepare === "husky install" || pkg.scripts.prepare === "husky init") {
|
|
203
|
+
pkg.scripts.prepare = "husky";
|
|
204
|
+
console.log(' ✔ 更新 scripts.prepare = "husky"');
|
|
194
205
|
modified = true;
|
|
195
206
|
} else {
|
|
196
207
|
console.log(" ⚠ scripts.prepare (已存在,跳过)");
|
|
@@ -231,6 +242,23 @@ async function updatePackageJson() {
|
|
|
231
242
|
console.log(" ⚠ config.commitizen.path (已存在,跳过)");
|
|
232
243
|
}
|
|
233
244
|
|
|
245
|
+
// 添加 pnpm overrides 来降级 string-width(兼容 Node.js 18)
|
|
246
|
+
if (!pkg.pnpm) {
|
|
247
|
+
pkg.pnpm = {};
|
|
248
|
+
}
|
|
249
|
+
if (!pkg.pnpm.overrides) {
|
|
250
|
+
pkg.pnpm.overrides = {};
|
|
251
|
+
}
|
|
252
|
+
if (pkg.pnpm.overrides["string-width"] !== "^7.0.0") {
|
|
253
|
+
pkg.pnpm.overrides["string-width"] = "^7.0.0";
|
|
254
|
+
console.log(
|
|
255
|
+
' ✔ 添加 pnpm.overrides.string-width = "^7.0.0" (兼容 Node.js 18)'
|
|
256
|
+
);
|
|
257
|
+
modified = true;
|
|
258
|
+
} else {
|
|
259
|
+
console.log(" ⚠ pnpm.overrides.string-width (已存在,跳过)");
|
|
260
|
+
}
|
|
261
|
+
|
|
234
262
|
if (modified) {
|
|
235
263
|
await writeJson("package.json", pkg);
|
|
236
264
|
}
|
|
@@ -264,17 +292,19 @@ async function installDependencies(pm, missingDeps) {
|
|
|
264
292
|
}
|
|
265
293
|
|
|
266
294
|
/**
|
|
267
|
-
* 执行 husky
|
|
295
|
+
* 执行 husky init
|
|
268
296
|
*/
|
|
269
297
|
async function runHuskyInstall(pm) {
|
|
270
298
|
console.log("\n🔧 初始化 husky...");
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
299
|
+
|
|
300
|
+
// 设置 Git hooks 路径为 .husky
|
|
301
|
+
const gitConfigCmd = "git config core.hooksPath .husky";
|
|
302
|
+
console.log(` 执行: ${gitConfigCmd}`);
|
|
303
|
+
const gitCode = await execLive(gitConfigCmd);
|
|
304
|
+
if (gitCode !== 0) {
|
|
305
|
+
throw new Error(`设置 Git hooks 路径失败,退出码: ${gitCode}`);
|
|
276
306
|
}
|
|
277
|
-
console.log(" ✔ husky
|
|
307
|
+
console.log(" ✔ Git hooks 路径已设置为 .husky");
|
|
278
308
|
}
|
|
279
309
|
|
|
280
310
|
/**
|
|
@@ -305,7 +335,7 @@ function printInstallCommand(missingDeps, defaultPm) {
|
|
|
305
335
|
const marker = pm === defaultPm ? " [推荐]" : "";
|
|
306
336
|
console.log(` ${command}${marker}`);
|
|
307
337
|
}
|
|
308
|
-
console.log("\n
|
|
338
|
+
console.log("\n安装后请运行 prepare 脚本来初始化 hooks(npm install 会自动执行)\n");
|
|
309
339
|
}
|
|
310
340
|
|
|
311
341
|
/**
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
|
|
2
1
|
module.exports = {
|
|
3
2
|
extends: ["@commitlint/config-conventional"],
|
|
4
3
|
rules: {
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
"feat", // 新功能
|
|
10
|
-
"fix", // 修复 bug
|
|
11
|
-
"docs", // 文档更新
|
|
12
|
-
"style", // 代码格式调整(不影响功能)
|
|
13
|
-
"refactor", // 重构
|
|
14
|
-
"perf", // 性能优化
|
|
15
|
-
"test", // 测试相关
|
|
16
|
-
"build", // 构建系统或外部依赖变动
|
|
17
|
-
"ci", // CI 配置变动
|
|
18
|
-
"chore", // 其他杂项
|
|
19
|
-
"revert", // 回滚提交
|
|
20
|
-
],
|
|
21
|
-
],
|
|
4
|
+
"scope-enum": [0],
|
|
5
|
+
"type-enum": [2, "always", ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"]],
|
|
6
|
+
"scope-empty": [2, "never"],
|
|
22
7
|
"subject-empty": [2, "never"],
|
|
23
8
|
"subject-max-length": [2, "always", 72],
|
|
24
9
|
},
|
|
10
|
+
prompt: {
|
|
11
|
+
messages: {
|
|
12
|
+
type: "选择你要提交的类型:",
|
|
13
|
+
scope: "填写 scope (必填,如: auth, login, user):",
|
|
14
|
+
subject: "填写简短描述 (必填,最多 72 字符):",
|
|
15
|
+
confirmCommit: "确认提交?",
|
|
16
|
+
},
|
|
17
|
+
types: [
|
|
18
|
+
{ value: "feat", name: "feat: 新功能" },
|
|
19
|
+
{ value: "fix", name: "fix: 修复 bug" },
|
|
20
|
+
{ value: "docs", name: "docs: 文档更新" },
|
|
21
|
+
{ value: "style", name: "style: 代码格式调整" },
|
|
22
|
+
{ value: "refactor", name: "refactor: 重构" },
|
|
23
|
+
{ value: "perf", name: "perf: 性能优化" },
|
|
24
|
+
{ value: "test", name: "test: 测试相关" },
|
|
25
|
+
{ value: "build", name: "build: 构建系统或外部依赖变动" },
|
|
26
|
+
{ value: "ci", name: "ci: CI 配置变动" },
|
|
27
|
+
{ value: "chore", name: "chore: 其他杂项" },
|
|
28
|
+
{ value: "revert", name: "revert: 回滚提交" },
|
|
29
|
+
],
|
|
30
|
+
useEmoji: false,
|
|
31
|
+
scopes: [],
|
|
32
|
+
enableMultipleScopes: false,
|
|
33
|
+
scopeEnumSeparator: ",",
|
|
34
|
+
allowCustomScopes: true,
|
|
35
|
+
allowEmptyScopes: false,
|
|
36
|
+
},
|
|
25
37
|
};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
# @Author: ChenYu ycyplus@gmail.com
|
|
4
|
-
# @Date: 2026-01-11 22:50:56
|
|
5
|
-
# @LastEditors: ChenYu ycyplus@gmail.com
|
|
6
|
-
# @LastEditTime: 2026-01-11 22:50:58
|
|
7
|
-
# @FilePath: \frontend-standards\templates\husky\commit-msg.sh
|
|
8
|
-
# @Description:
|
|
9
|
-
# Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
10
|
-
###
|
|
2
|
+
|
|
11
3
|
. "$(dirname "$0")/_/husky.sh"
|
|
12
4
|
npx --no-install commitlint --edit "$1"
|
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
###
|
|
3
|
-
# @Author: ChenYu ycyplus@gmail.com
|
|
4
|
-
# @Date: 2026-01-11 22:50:49
|
|
5
|
-
# @LastEditors: ChenYu ycyplus@gmail.com
|
|
6
|
-
# @LastEditTime: 2026-01-11 22:50:52
|
|
7
|
-
# @FilePath: \frontend-standards\templates\husky\pre-commit.sh
|
|
8
|
-
# @Description:
|
|
9
|
-
# Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
10
|
-
###
|
|
11
2
|
. "$(dirname "$0")/_/husky.sh"
|
|
12
3
|
npx --no-install lint-staged
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @Date: 2026-01-11 22:50:42
|
|
4
|
-
* @LastEditors: ChenYu ycyplus@gmail.com
|
|
5
|
-
* @LastEditTime: 2026-01-11 22:50:45
|
|
6
|
-
* @FilePath: \frontend-standards\templates\lint-staged\config.cjs
|
|
7
|
-
* @Description:
|
|
8
|
-
* Copyright (c) 2026 by CHENY, All Rights Reserved 😎.
|
|
9
|
-
*/
|
|
1
|
+
|
|
2
|
+
|
|
10
3
|
module.exports = {
|
|
11
4
|
"*.{js,jsx,ts,tsx,vue}": ["eslint --fix"],
|
|
12
5
|
"*.{js,jsx,ts,tsx,vue,css,scss,less,md,json,yml,yaml}": ["prettier --write"],
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
types: [
|
|
3
|
-
{ value: "feat", name: "feat: 新功能 (feature)" },
|
|
4
|
-
{ value: "fix", name: "fix: 修复 bug (fix)" },
|
|
5
|
-
{ value: "docs", name: "docs: 文档更新 (documentation)" },
|
|
6
|
-
{ value: "style", name: "style: 代码格式调整(不影响功能)(style)" },
|
|
7
|
-
{ value: "refactor", name: "refactor: 重构 (refactor)" },
|
|
8
|
-
{ value: "perf", name: "perf: 性能优化 (performance)" },
|
|
9
|
-
{ value: "test", name: "test: 测试相关 (test)" },
|
|
10
|
-
{ value: "build", name: "build: 构建系统或外部依赖变动 (build)" },
|
|
11
|
-
{ value: "ci", name: "ci: CI 配置变动 (ci)" },
|
|
12
|
-
{ value: "chore", name: "chore: 其他杂项 (chore)" },
|
|
13
|
-
{ value: "revert", name: "revert: 回滚提交 (revert)" },
|
|
14
|
-
],
|
|
15
|
-
|
|
16
|
-
// 交互提示信息
|
|
17
|
-
messages: {
|
|
18
|
-
type: "选择你要提交的类型:",
|
|
19
|
-
scope: "填写 scope (对应代码模块):",
|
|
20
|
-
customScope: "请输入自定义 scope:",
|
|
21
|
-
subject: "填写简短描述 (必填):",
|
|
22
|
-
confirmCommit: "确认提交?",
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
// 是否允许自定义 scope
|
|
26
|
-
allowCustomScopes: true,
|
|
27
|
-
|
|
28
|
-
// 是否允许空 scope(false 表示必须填写)
|
|
29
|
-
allowEmptyScopes: false,
|
|
30
|
-
|
|
31
|
-
// scope 是否从枚举列表选择(false 表示手动输入)
|
|
32
|
-
scopeEnum: false,
|
|
33
|
-
|
|
34
|
-
// 是否允许自定义 type
|
|
35
|
-
allowCustomTypes: false,
|
|
36
|
-
|
|
37
|
-
// 是否允许空 subject
|
|
38
|
-
allowEmptySubject: false,
|
|
39
|
-
|
|
40
|
-
// subject 最大长度
|
|
41
|
-
subjectMaxLength: 72,
|
|
42
|
-
|
|
43
|
-
// 是否允许 breaking 变更
|
|
44
|
-
allowBreakingChanges: ["feat", "fix"],
|
|
45
|
-
};
|