@robot-admin/git-standards 1.0.0
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/CHANGELOG.md +62 -0
- package/README.md +324 -0
- package/bin/robot-standards.js +64 -0
- package/dist/cli/doctor.cjs +276 -0
- package/dist/cli/doctor.cjs.map +1 -0
- package/dist/cli/doctor.d.cts +10 -0
- package/dist/cli/doctor.d.ts +10 -0
- package/dist/cli/doctor.js +241 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/init.cjs +1032 -0
- package/dist/cli/init.cjs.map +1 -0
- package/dist/cli/init.d.cts +31 -0
- package/dist/cli/init.d.ts +31 -0
- package/dist/cli/init.js +997 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/index.cjs +1280 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +86 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +1228 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2026-02-13
|
|
6
|
+
|
|
7
|
+
### ✨ Features
|
|
8
|
+
|
|
9
|
+
#### 核心功能
|
|
10
|
+
|
|
11
|
+
- 🚀 零配置初始化命令 `robot-standards init`
|
|
12
|
+
- 🔍 诊断命令 `robot-standards doctor`
|
|
13
|
+
- 🎯 智能包管理器检测(npm/yarn/pnpm/bun)
|
|
14
|
+
- 🌈 多框架支持(Vue 3/React/Vanilla)
|
|
15
|
+
|
|
16
|
+
#### 集成工具
|
|
17
|
+
|
|
18
|
+
- ✅ Commitizen + cz-customizable(交互式提交)
|
|
19
|
+
- ✅ Commitlint(提交信息校验)
|
|
20
|
+
- ✅ ESLint 9.x(代码检查,支持 Flat Config)
|
|
21
|
+
- ✅ Oxlint(高性能 Lint,可选)
|
|
22
|
+
- ✅ Prettier(代码格式化,可选)
|
|
23
|
+
- ✅ Husky(Git Hooks 管理)
|
|
24
|
+
- ✅ Lint-staged(暂存文件检查)
|
|
25
|
+
|
|
26
|
+
#### 配置生成器
|
|
27
|
+
|
|
28
|
+
- 📝 `createCommitizenConfig` - Commitizen 配置
|
|
29
|
+
- 📝 `createCommitlintConfig` - Commitlint 配置
|
|
30
|
+
- 📝 `createESLintConfig` - ESLint 配置
|
|
31
|
+
- 📝 `createPrettierConfig` - Prettier 配置
|
|
32
|
+
- 📝 `createLintStagedConfig` - Lint-staged 配置
|
|
33
|
+
|
|
34
|
+
#### 工具函数
|
|
35
|
+
|
|
36
|
+
- 🔧 `detectPackageManager` - 包管理器检测
|
|
37
|
+
- 🔧 `isGitRepository` - Git 仓库检测
|
|
38
|
+
- 🔧 `fileExists` - 文件存在检查
|
|
39
|
+
- 🔧 更多实用工具...
|
|
40
|
+
|
|
41
|
+
### 🎨 Commit Types
|
|
42
|
+
|
|
43
|
+
支持以下提交类型:
|
|
44
|
+
|
|
45
|
+
- `wip` - 🚧 开发中
|
|
46
|
+
- `feat` - 🎯 新功能
|
|
47
|
+
- `fix` - 🐛 Bug 修复
|
|
48
|
+
- `perf` - ⚡️ 性能优化
|
|
49
|
+
- `deps` - 📦 依赖更新
|
|
50
|
+
- `refactor` - ♻️ 重构
|
|
51
|
+
- `docs` - 📚 文档变更
|
|
52
|
+
- `test` - 🔎 测试相关
|
|
53
|
+
- `style` - 💄 代码样式
|
|
54
|
+
- `build` - 🧳 构建/打包
|
|
55
|
+
- `chore` - 🔧 其他杂项
|
|
56
|
+
- `revert` - 🔙 回退
|
|
57
|
+
|
|
58
|
+
### 📦 Package
|
|
59
|
+
|
|
60
|
+
- 首次发布到 npm
|
|
61
|
+
- 支持 ESM + CJS 双模块格式
|
|
62
|
+
- 完整 TypeScript 类型定义
|
package/README.md
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# @robot-admin/git-standards
|
|
2
|
+
|
|
3
|
+
零配置 · 模块化 · Git 工程化标准工具包
|
|
4
|
+
|
|
5
|
+
集成 Commitizen + Commitlint + Husky + ESLint + Prettier + Oxlint + lint-staged,支持按需选配。
|
|
6
|
+
|
|
7
|
+
## 快速开始
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 安装(workspace 项目)
|
|
11
|
+
bun add --dev @robot-admin/git-standards
|
|
12
|
+
|
|
13
|
+
# 初始化(交互式引导)
|
|
14
|
+
node node_modules/@robot-admin/git-standards/bin/robot-standards.js init
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
运行后进入交互式引导,选择预设方案即可完成全部配置。
|
|
18
|
+
|
|
19
|
+
> **注意**:所有配置文件生成后即为完整独立文件,不依赖本包的运行时导入,直接修改即可自定义。
|
|
20
|
+
|
|
21
|
+
## 提交代码
|
|
22
|
+
|
|
23
|
+
初始化完成后,有两种方式唤醒规范化提交:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 方式一:通过 package.json scripts(无需全局安装)
|
|
27
|
+
bun run cz
|
|
28
|
+
npm run cz
|
|
29
|
+
|
|
30
|
+
# 方式二:通过 git 子命令(需全局安装 commitizen)
|
|
31
|
+
npm install -g commitizen
|
|
32
|
+
git cz
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
两种方式效果完全一致,都会唤醒交互式提交:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
? 请选择提交类型: fix: 🐛 Bug 修复
|
|
39
|
+
? 请输入修改范围: 登录
|
|
40
|
+
? 请简要描述提交: 修复登录相关逻辑
|
|
41
|
+
→ fix(登录): 修复登录相关逻辑
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 预设模式
|
|
45
|
+
|
|
46
|
+
| 模式 | 包含功能 | 依赖数 | 适用场景 |
|
|
47
|
+
| ---------- | ------------------------------------- | ------ | ----------------------------------------------- |
|
|
48
|
+
| **极简** | Commitizen + Commitlint + Husky | ~5 | 只需规范提交信息 |
|
|
49
|
+
| **标准** | + ESLint + lint-staged + EditorConfig | ~10 | 需要代码质量检查 |
|
|
50
|
+
| **完整** | + Prettier + Oxlint + JSDoc(全部) | ~16 | 全面代码质量管控,主项目 Robot_Admin 使用此模式 |
|
|
51
|
+
| **自定义** | checkbox 自由勾选 | 按需 | 精确控制每个功能模块 |
|
|
52
|
+
|
|
53
|
+
### 极简模式
|
|
54
|
+
|
|
55
|
+
仅安装 Git 提交规范工具链,不涉及任何代码检查/格式化:
|
|
56
|
+
|
|
57
|
+
- ✔ Commitizen + cz-customizable(规范提交交互)
|
|
58
|
+
- ✔ Commitlint(提交信息校验)
|
|
59
|
+
- ✔ Husky commit-msg hook
|
|
60
|
+
- ✗ 无 pre-commit hook
|
|
61
|
+
- ✗ 无 ESLint / Prettier / lint-staged
|
|
62
|
+
|
|
63
|
+
### 标准模式
|
|
64
|
+
|
|
65
|
+
在极简基础上增加代码质量检查:
|
|
66
|
+
|
|
67
|
+
- ✔ 极简模式全部功能
|
|
68
|
+
- ✔ ESLint(支持 Vue 3 / React / Vanilla)
|
|
69
|
+
- ✔ lint-staged(暂存区增量检查)
|
|
70
|
+
- ✔ Husky pre-commit hook
|
|
71
|
+
- ✔ EditorConfig
|
|
72
|
+
|
|
73
|
+
### 完整模式
|
|
74
|
+
|
|
75
|
+
全部工具链,与 Robot_Admin 主项目一致:
|
|
76
|
+
|
|
77
|
+
- ✔ 标准模式全部功能
|
|
78
|
+
- ✔ Prettier(代码自动格式化)
|
|
79
|
+
- ✔ Oxlint(50x faster Lint 引擎)
|
|
80
|
+
- ✔ JSDoc 强制注释(默认启用)
|
|
81
|
+
|
|
82
|
+
### 自定义模式
|
|
83
|
+
|
|
84
|
+
通过 checkbox 逐一勾选需要的功能模块:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
ESLint 代码质量检查
|
|
88
|
+
lint-staged 暂存区增量检查
|
|
89
|
+
Prettier 代码自动格式化
|
|
90
|
+
Oxlint 高性能 Lint 引擎
|
|
91
|
+
EditorConfig 编辑器统一配置
|
|
92
|
+
↩ 返回上一步
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> Commitizen + Commitlint + Husky 为核心功能,始终包含。
|
|
96
|
+
|
|
97
|
+
## 交互流程
|
|
98
|
+
|
|
99
|
+
```mermaid
|
|
100
|
+
flowchart TD
|
|
101
|
+
A["robot-standards init"] --> B["环境检测<br/>Git 仓库 + 包管理器"]
|
|
102
|
+
B --> C{"选择预设方案"}
|
|
103
|
+
|
|
104
|
+
C -->|极简| D1["仅提交规范<br/>Commitizen + Commitlint"]
|
|
105
|
+
C -->|标准| D2["提交规范 + ESLint<br/>+ lint-staged"]
|
|
106
|
+
C -->|完整| D3["全部工具链<br/>+ Prettier + Oxlint + JSDoc"]
|
|
107
|
+
C -->|自定义| D4["checkbox 勾选<br/>附加功能模块"]
|
|
108
|
+
|
|
109
|
+
D1 --> SKIP["跳过 ESLint 配置"]
|
|
110
|
+
D2 --> ESLINT["ESLint 配置<br/>框架 / TypeScript / JSDoc"]
|
|
111
|
+
D3 --> ESLINT
|
|
112
|
+
D4 -->|"选了 ESLint"| ESLINT
|
|
113
|
+
D4 -->|"未选 ESLint"| SKIP
|
|
114
|
+
D4 -->|"返回"| C
|
|
115
|
+
|
|
116
|
+
ESLINT --> SUMMARY["配置摘要 + 确认"]
|
|
117
|
+
ESLINT -->|"返回"| C
|
|
118
|
+
SKIP --> SUMMARY
|
|
119
|
+
|
|
120
|
+
SUMMARY -->|确认| EXEC["安装依赖<br/>生成配置文件<br/>初始化 Husky<br/>更新 package.json"]
|
|
121
|
+
SUMMARY -->|否| C
|
|
122
|
+
|
|
123
|
+
EXEC --> DONE["初始化完成"]
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## CI / 非交互模式
|
|
127
|
+
|
|
128
|
+
通过 `--ci` 跳过交互,配合 `--preset` 指定预设:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# 极简模式
|
|
132
|
+
robot-standards init --ci --preset minimal
|
|
133
|
+
|
|
134
|
+
# 标准模式(默认)
|
|
135
|
+
robot-standards init --ci --preset standard
|
|
136
|
+
|
|
137
|
+
# 完整模式
|
|
138
|
+
robot-standards init --ci --preset full
|
|
139
|
+
|
|
140
|
+
# 完整模式 + 自定义选项
|
|
141
|
+
robot-standards init --ci --preset full --framework react --typescript --no-jsdoc
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### CLI 参数
|
|
145
|
+
|
|
146
|
+
| 参数 | 说明 | 默认值 |
|
|
147
|
+
| ------------------ | -------------------------------------- | ---------------- |
|
|
148
|
+
| `--cwd <path>` | 目标目录 | 当前目录 |
|
|
149
|
+
| `--ci` | 非交互式模式 | `false` |
|
|
150
|
+
| `--preset <id>` | 预设方案 `minimal \| standard \| full` | `standard` |
|
|
151
|
+
| `--framework <fw>` | 项目框架 `vue \| react \| vanilla` | `vue` |
|
|
152
|
+
| `--typescript` | 启用 TypeScript | CI 模式下 `true` |
|
|
153
|
+
| `--jsdoc` | 强制 JSDoc 注释 | full 时 `true` |
|
|
154
|
+
| `--oxlint` | 启用 Oxlint | 跟随预设 |
|
|
155
|
+
| `--prettier` | 启用 Prettier | 跟随预设 |
|
|
156
|
+
|
|
157
|
+
## 配置自定义
|
|
158
|
+
|
|
159
|
+
所有生成的文件都是**完整独立的配置**,不依赖本包的任何运行时导入。直接修改文件即可:
|
|
160
|
+
|
|
161
|
+
### ESLint — eslint.config.ts
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
// 生成后直接在规则对象里增删改即可
|
|
165
|
+
export default defineConfigWithVueTs(
|
|
166
|
+
// ...已有配置
|
|
167
|
+
|
|
168
|
+
// 新增项目专属忽略
|
|
169
|
+
{
|
|
170
|
+
name: "app/files-to-ignore",
|
|
171
|
+
ignores: [
|
|
172
|
+
"**/dist/**",
|
|
173
|
+
"**/src/api/generated/**", // 按需添加
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
// 新增自定义规则
|
|
178
|
+
{
|
|
179
|
+
rules: {
|
|
180
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
);
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Commitizen — .cz-config.js
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
// 直接改 types / scopes / messages
|
|
190
|
+
module.exports = {
|
|
191
|
+
scopes: [{ name: "core" }, { name: "ui" }],
|
|
192
|
+
types: [
|
|
193
|
+
// 增加自定义类型...
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Prettier — .prettierrc.js
|
|
199
|
+
|
|
200
|
+
```js
|
|
201
|
+
// 直接改任意选项
|
|
202
|
+
module.exports = {
|
|
203
|
+
printWidth: 100, // 默认 80,改为 100
|
|
204
|
+
semi: true, // 默认 false,改为 true
|
|
205
|
+
};
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Commitlint — commitlint.config.js
|
|
209
|
+
|
|
210
|
+
```js
|
|
211
|
+
// 增加自定义 type 或调整规则
|
|
212
|
+
module.exports = {
|
|
213
|
+
extends: ["@commitlint/config-conventional"],
|
|
214
|
+
rules: {
|
|
215
|
+
"type-enum": [
|
|
216
|
+
2,
|
|
217
|
+
"always",
|
|
218
|
+
[
|
|
219
|
+
// 在这里增删 type...
|
|
220
|
+
],
|
|
221
|
+
],
|
|
222
|
+
"header-max-length": [2, "always", 120],
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## 生成的文件清单
|
|
228
|
+
|
|
229
|
+
| 文件 | 极简 | 标准 | 完整 | 说明 |
|
|
230
|
+
| ---------------------- | :--: | :--: | :--: | ----------------------- |
|
|
231
|
+
| `.cz-config.js` | ✔ | ✔ | ✔ | Commitizen 提交类型配置 |
|
|
232
|
+
| `commitlint.config.js` | ✔ | ✔ | ✔ | 提交信息校验规则 |
|
|
233
|
+
| `.husky/commit-msg` | ✔ | ✔ | ✔ | 提交信息 hook |
|
|
234
|
+
| `.husky/pre-commit` | - | ✔ | ✔ | 代码检查 hook |
|
|
235
|
+
| `eslint.config.ts` | - | ✔ | ✔ | ESLint Flat Config |
|
|
236
|
+
| `.editorconfig` | - | ✔ | ✔ | 编辑器统一配置 |
|
|
237
|
+
| `.prettierrc.js` | - | - | ✔ | 代码格式化配置 |
|
|
238
|
+
|
|
239
|
+
## Git 提交完整流程
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
bun run cz / git cz
|
|
243
|
+
│
|
|
244
|
+
▼
|
|
245
|
+
.cz-config.js → 交互式选类型、填 scope、写描述
|
|
246
|
+
│
|
|
247
|
+
▼
|
|
248
|
+
git commit(由 commitizen 触发)
|
|
249
|
+
│
|
|
250
|
+
├─ .husky/pre-commit 触发:
|
|
251
|
+
│ 1. oxlint --max-warnings 0 ← 快速全量 lint
|
|
252
|
+
│ 2. lint-staged ← 增量检查暂存文件
|
|
253
|
+
│ ├─ oxlint --deny-warnings
|
|
254
|
+
│ ├─ eslint --fix --no-cache
|
|
255
|
+
│ └─ prettier --write
|
|
256
|
+
│
|
|
257
|
+
├─ .husky/commit-msg 触发:
|
|
258
|
+
│ commitlint --edit "$1" ← 校验提交信息格式
|
|
259
|
+
│
|
|
260
|
+
▼
|
|
261
|
+
提交成功 ✅
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## package.json 变更
|
|
265
|
+
|
|
266
|
+
init 会自动更新 `package.json`:
|
|
267
|
+
|
|
268
|
+
```jsonc
|
|
269
|
+
{
|
|
270
|
+
"scripts": {
|
|
271
|
+
"cz": "git-cz", // 始终添加
|
|
272
|
+
"prepare": "husky", // 始终添加
|
|
273
|
+
"lint": "oxlint ... && eslint ...", // 仅标准/完整模式
|
|
274
|
+
"format": "prettier --write src/" // 仅完整模式
|
|
275
|
+
},
|
|
276
|
+
"config": {
|
|
277
|
+
"commitizen": { "path": "node_modules/cz-customizable" }
|
|
278
|
+
},
|
|
279
|
+
"lint-staged": {
|
|
280
|
+
// 仅标准/完整模式
|
|
281
|
+
"src/**/*.{js,jsx,ts,tsx,vue}": [
|
|
282
|
+
"oxlint --max-warnings 0 --deny-warnings",
|
|
283
|
+
"eslint --fix --no-cache",
|
|
284
|
+
"prettier --write"
|
|
285
|
+
]
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Doctor 诊断
|
|
291
|
+
|
|
292
|
+
检查当前项目的 Git 标准化配置状态:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
node node_modules/@robot-admin/git-standards/bin/robot-standards.js doctor
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
智能检测已安装的功能模块,未安装的功能标记为 `○ 未启用` 而非失败:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
核心功能
|
|
302
|
+
|
|
303
|
+
✔ Git 仓库
|
|
304
|
+
✔ Husky 目录
|
|
305
|
+
✔ commit-msg hook
|
|
306
|
+
✔ Commitlint 配置
|
|
307
|
+
✔ Commitizen 配置
|
|
308
|
+
✔ cz 脚本
|
|
309
|
+
|
|
310
|
+
已启用的功能
|
|
311
|
+
|
|
312
|
+
✔ ESLint 配置
|
|
313
|
+
✔ Prettier 配置
|
|
314
|
+
✔ lint-staged 配置
|
|
315
|
+
✔ pre-commit hook
|
|
316
|
+
|
|
317
|
+
未启用的功能
|
|
318
|
+
|
|
319
|
+
○ EditorConfig
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## License
|
|
323
|
+
|
|
324
|
+
MIT
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* @Author: ChenYu ycyplus@gmail.com
|
|
5
|
+
* @Date: 2026-02-13
|
|
6
|
+
* @Description: Robot Standards CLI 入口
|
|
7
|
+
* Copyright (c) 2026 by CHENY, All Rights Reserved.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Command } from "commander";
|
|
11
|
+
import chalk from "chalk";
|
|
12
|
+
import { init } from "../dist/cli/init.js";
|
|
13
|
+
import { doctor } from "../dist/cli/doctor.js";
|
|
14
|
+
|
|
15
|
+
const program = new Command();
|
|
16
|
+
|
|
17
|
+
program
|
|
18
|
+
.name("robot-standards")
|
|
19
|
+
.description("零配置 Git 工程化标准工具包")
|
|
20
|
+
.version("1.0.0");
|
|
21
|
+
|
|
22
|
+
program
|
|
23
|
+
.command("init")
|
|
24
|
+
.description("初始化 Git 标准化配置")
|
|
25
|
+
.option("--cwd <path>", "目标目录", process.cwd())
|
|
26
|
+
.option("--ci", "CI 模式(非交互式)", false)
|
|
27
|
+
.option("--preset <preset>", "预设方案 (minimal|standard|full)", "standard")
|
|
28
|
+
.option("--framework <framework>", "项目框架 (vue|react|vanilla)", "vue")
|
|
29
|
+
.option("--typescript", "使用 TypeScript")
|
|
30
|
+
.option("--no-typescript", "不使用 TypeScript")
|
|
31
|
+
.option("--oxlint", "启用 Oxlint")
|
|
32
|
+
.option("--no-oxlint", "不启用 Oxlint")
|
|
33
|
+
.option("--prettier", "启用 Prettier")
|
|
34
|
+
.option("--no-prettier", "不启用 Prettier")
|
|
35
|
+
.action(async (options) => {
|
|
36
|
+
try {
|
|
37
|
+
await init(options);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
console.error(
|
|
40
|
+
`\n ${chalk.red("x")} ${chalk.red.bold("初始化失败:")}`,
|
|
41
|
+
error.message || error,
|
|
42
|
+
);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
program
|
|
48
|
+
.command("doctor")
|
|
49
|
+
.description("诊断 Git 工程化配置")
|
|
50
|
+
.option("--cwd <path>", "目标目录", process.cwd())
|
|
51
|
+
.action(async (options) => {
|
|
52
|
+
try {
|
|
53
|
+
const passed = await doctor(options);
|
|
54
|
+
process.exit(passed ? 0 : 1);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error(
|
|
57
|
+
`\n ${chalk.red("x")} ${chalk.red.bold("诊断失败:")}`,
|
|
58
|
+
error.message || error,
|
|
59
|
+
);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
program.parse();
|