daodou-command 1.4.7 → 1.4.8
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/lib/commands/build.js +118 -143
- package/lib/utils/browser.js +200 -34
- package/package.json +1 -1
- package/.claude/settings.local.json +0 -20
- package/.idea/UniappTool.xml +0 -10
- package/.idea/copilot.data.migration.agent.xml +0 -6
- package/.idea/copilot.data.migration.ask.xml +0 -6
- package/.idea/copilot.data.migration.ask2agent.xml +0 -6
- package/.idea/copilot.data.migration.edit.xml +0 -6
- package/.idea/daodou-command.iml +0 -12
- package/.idea/editorJumperProjectSettings.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -84
- package/AI_QUICK_REFERENCE.md +0 -202
- package/CHANGELOG.md +0 -210
- package/COMMAND_DEVELOPMENT_GUIDE.md +0 -504
|
@@ -1,504 +0,0 @@
|
|
|
1
|
-
# 刀豆命令行工具 - 命令开发规范
|
|
2
|
-
|
|
3
|
-
> 本文档为AI智能体提供详细的命令开发指南,确保新命令符合项目规范和最佳实践。
|
|
4
|
-
|
|
5
|
-
## 📋 目录
|
|
6
|
-
|
|
7
|
-
- [项目架构](#项目架构)
|
|
8
|
-
- [命令开发规范](#命令开发规范)
|
|
9
|
-
- [文件结构规范](#文件结构规范)
|
|
10
|
-
- [代码规范](#代码规范)
|
|
11
|
-
- [错误处理规范](#错误处理规范)
|
|
12
|
-
- [测试规范](#测试规范)
|
|
13
|
-
- [发布规范](#发布规范)
|
|
14
|
-
- [常见问题](#常见问题)
|
|
15
|
-
|
|
16
|
-
## 🏗️ 项目架构
|
|
17
|
-
|
|
18
|
-
### 核心文件结构
|
|
19
|
-
```
|
|
20
|
-
daodou-command/
|
|
21
|
-
├── bin/
|
|
22
|
-
│ └── daodou.js # 主程序入口,命令注册中心
|
|
23
|
-
├── lib/
|
|
24
|
-
│ ├── commands/ # 命令实现目录
|
|
25
|
-
│ │ ├── build.js # 构建命令
|
|
26
|
-
│ │ ├── lang.js # 多语言命令
|
|
27
|
-
│ │ └── upgrade.js # 更新命令
|
|
28
|
-
│ └── utils/ # 工具模块目录
|
|
29
|
-
│ ├── update-checker.js # 更新检查器
|
|
30
|
-
│ ├── git.js # Git工具
|
|
31
|
-
│ └── ... # 其他工具模块
|
|
32
|
-
├── package.json # 项目配置
|
|
33
|
-
├── CHANGELOG.md # 更新日志
|
|
34
|
-
└── README.md # 项目说明
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### 命令注册流程
|
|
38
|
-
1. 在 `bin/daodou.js` 中注册命令
|
|
39
|
-
2. 在 `lib/commands/` 中实现命令逻辑
|
|
40
|
-
3. 在 `lib/utils/` 中实现工具函数
|
|
41
|
-
4. 更新帮助信息和文档
|
|
42
|
-
|
|
43
|
-
## 📝 命令开发规范
|
|
44
|
-
|
|
45
|
-
### 1. 命令注册规范
|
|
46
|
-
|
|
47
|
-
#### 基本命令注册
|
|
48
|
-
```javascript
|
|
49
|
-
// 在 bin/daodou.js 中添加命令
|
|
50
|
-
program
|
|
51
|
-
.command('command-name')
|
|
52
|
-
.description('命令描述 - 简洁明了的功能说明')
|
|
53
|
-
.option('-o, --option <value>', '选项描述')
|
|
54
|
-
.action(async (options) => {
|
|
55
|
-
try {
|
|
56
|
-
const commandModule = require('../lib/commands/command-name');
|
|
57
|
-
await commandModule.execute(options);
|
|
58
|
-
} catch (error) {
|
|
59
|
-
console.error(chalk.red('命令执行失败:'), error.message);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
#### 子命令注册
|
|
66
|
-
```javascript
|
|
67
|
-
// 子命令模式(如 lang 命令)
|
|
68
|
-
const subCmd = program
|
|
69
|
-
.command('parent-command')
|
|
70
|
-
.description('父命令描述');
|
|
71
|
-
|
|
72
|
-
subCmd
|
|
73
|
-
.command('sub-command <param>')
|
|
74
|
-
.description('子命令描述')
|
|
75
|
-
.option('-o, --option <value>', '选项描述')
|
|
76
|
-
.action(async (param, options) => {
|
|
77
|
-
try {
|
|
78
|
-
const commandModule = require('../lib/commands/parent-command');
|
|
79
|
-
await commandModule.subCommand(param, options);
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.error(chalk.red('子命令执行失败:'), error.message);
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### 2. 命令实现规范
|
|
88
|
-
|
|
89
|
-
#### 命令模块结构
|
|
90
|
-
```javascript
|
|
91
|
-
// lib/commands/example.js
|
|
92
|
-
const chalk = require('chalk');
|
|
93
|
-
const ora = require('ora');
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* 执行示例命令
|
|
97
|
-
* @param {Object} options - 命令选项
|
|
98
|
-
* @param {string} options.param - 参数值
|
|
99
|
-
* @param {boolean} options.flag - 标志选项
|
|
100
|
-
*/
|
|
101
|
-
async function execute(options) {
|
|
102
|
-
const spinner = ora('执行中...').start();
|
|
103
|
-
|
|
104
|
-
try {
|
|
105
|
-
// 1. 参数验证
|
|
106
|
-
validateOptions(options);
|
|
107
|
-
|
|
108
|
-
// 2. 业务逻辑
|
|
109
|
-
const result = await performAction(options);
|
|
110
|
-
|
|
111
|
-
// 3. 结果输出
|
|
112
|
-
spinner.succeed('执行成功');
|
|
113
|
-
console.log(chalk.green('结果:'), result);
|
|
114
|
-
|
|
115
|
-
} catch (error) {
|
|
116
|
-
spinner.fail('执行失败');
|
|
117
|
-
throw error;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* 验证命令选项
|
|
123
|
-
* @param {Object} options - 命令选项
|
|
124
|
-
*/
|
|
125
|
-
function validateOptions(options) {
|
|
126
|
-
if (!options.param) {
|
|
127
|
-
throw new Error('缺少必需参数 --param');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* 执行具体业务逻辑
|
|
133
|
-
* @param {Object} options - 命令选项
|
|
134
|
-
* @returns {Promise<any>} 执行结果
|
|
135
|
-
*/
|
|
136
|
-
async function performAction(options) {
|
|
137
|
-
// 实现具体逻辑
|
|
138
|
-
return '执行结果';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
module.exports = {
|
|
142
|
-
execute,
|
|
143
|
-
validateOptions,
|
|
144
|
-
performAction
|
|
145
|
-
};
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
### 3. 选项设计规范
|
|
149
|
-
|
|
150
|
-
#### 选项命名规范
|
|
151
|
-
- 短选项:单个字母,如 `-v`, `-h`
|
|
152
|
-
- 长选项:描述性名称,如 `--version`, `--help`
|
|
153
|
-
- 参数选项:使用尖括号,如 `--file <path>`
|
|
154
|
-
- 布尔选项:不使用参数,如 `--force`, `--verbose`
|
|
155
|
-
|
|
156
|
-
#### 常用选项模式
|
|
157
|
-
```javascript
|
|
158
|
-
// 帮助选项(自动添加)
|
|
159
|
-
.option('-h, --help', '显示帮助信息')
|
|
160
|
-
|
|
161
|
-
// 版本选项(自动添加)
|
|
162
|
-
.option('-v, --version', '显示版本号')
|
|
163
|
-
|
|
164
|
-
// 文件路径选项
|
|
165
|
-
.option('-f, --file <path>', '指定文件路径')
|
|
166
|
-
|
|
167
|
-
// 布尔标志选项
|
|
168
|
-
.option('--force', '强制执行,跳过确认')
|
|
169
|
-
|
|
170
|
-
// 多值选项
|
|
171
|
-
.option('-e, --env <environment>', '指定环境', 'development')
|
|
172
|
-
|
|
173
|
-
// 必需参数
|
|
174
|
-
.argument('<required-param>', '必需参数描述')
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## 📁 文件结构规范
|
|
178
|
-
|
|
179
|
-
### 命令文件命名
|
|
180
|
-
- 文件名:使用小写字母和连字符,如 `build.js`, `upgrade.js`
|
|
181
|
-
- 目录名:使用小写字母和连字符,如 `commands/`, `utils/`
|
|
182
|
-
|
|
183
|
-
### 工具模块命名
|
|
184
|
-
- 功能模块:`功能名.js`,如 `git.js`, `config.js`
|
|
185
|
-
- 工具模块:`工具名-manager.js`,如 `proxy-manager.js`
|
|
186
|
-
|
|
187
|
-
### 文件组织原则
|
|
188
|
-
1. **单一职责**:每个文件只负责一个功能
|
|
189
|
-
2. **模块化**:相关功能组织在一起
|
|
190
|
-
3. **可复用**:工具函数独立成模块
|
|
191
|
-
4. **可测试**:每个函数都可以独立测试
|
|
192
|
-
|
|
193
|
-
## 🚫 开发约束
|
|
194
|
-
|
|
195
|
-
### 1. 系统级约束
|
|
196
|
-
- **禁止修改主程序更新检查逻辑** - 所有更新检查都在 `bin/daodou.js` 中统一处理
|
|
197
|
-
- **禁止重复实现更新检查** - 新命令自动获得更新检查功能
|
|
198
|
-
- **禁止直接调用 `process.exit()`** - 使用统一的错误处理机制
|
|
199
|
-
- **禁止阻塞主事件循环** - 所有长时间操作必须异步执行
|
|
200
|
-
|
|
201
|
-
### 2. 性能约束
|
|
202
|
-
- **网络请求超时** - 必须设置合理的超时时间(建议5-10秒)
|
|
203
|
-
- **内存使用** - 避免大量数据同时加载到内存
|
|
204
|
-
- **文件操作** - 处理权限错误和磁盘空间不足
|
|
205
|
-
- **并发限制** - 避免同时发起过多网络请求
|
|
206
|
-
|
|
207
|
-
### 3. 兼容性约束
|
|
208
|
-
- **Node.js版本** - 支持 Node.js >= 14.0.0
|
|
209
|
-
- **向后兼容** - 新版本不能破坏现有功能
|
|
210
|
-
- **跨平台** - 确保在 Windows、macOS、Linux 上都能正常运行
|
|
211
|
-
- **依赖管理** - 新增依赖需要评估影响
|
|
212
|
-
|
|
213
|
-
### 4. 安全约束
|
|
214
|
-
- **输入验证** - 所有用户输入必须验证
|
|
215
|
-
- **文件路径** - 防止路径遍历攻击
|
|
216
|
-
- **网络请求** - 验证响应数据格式
|
|
217
|
-
- **权限检查** - 确保有足够权限执行操作
|
|
218
|
-
|
|
219
|
-
## 💻 代码规范
|
|
220
|
-
|
|
221
|
-
### 1. 代码风格
|
|
222
|
-
```javascript
|
|
223
|
-
// ✅ 好的示例
|
|
224
|
-
const chalk = require('chalk');
|
|
225
|
-
const ora = require('ora');
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* 执行命令的主要函数
|
|
229
|
-
* @param {Object} options - 命令选项
|
|
230
|
-
* @returns {Promise<void>}
|
|
231
|
-
*/
|
|
232
|
-
async function execute(options) {
|
|
233
|
-
try {
|
|
234
|
-
// 业务逻辑
|
|
235
|
-
const result = await performAction(options);
|
|
236
|
-
console.log(chalk.green('成功:'), result);
|
|
237
|
-
} catch (error) {
|
|
238
|
-
console.error(chalk.red('错误:'), error.message);
|
|
239
|
-
throw error;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// ❌ 避免的写法
|
|
244
|
-
function execute(options) {
|
|
245
|
-
// 缺少注释
|
|
246
|
-
// 没有错误处理
|
|
247
|
-
// 没有类型说明
|
|
248
|
-
}
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### 2. 注释规范
|
|
252
|
-
```javascript
|
|
253
|
-
/**
|
|
254
|
-
* 函数描述
|
|
255
|
-
* @param {类型} 参数名 - 参数描述
|
|
256
|
-
* @param {类型} [可选参数] - 可选参数描述
|
|
257
|
-
* @returns {类型} 返回值描述
|
|
258
|
-
* @throws {Error} 可能抛出的错误
|
|
259
|
-
* @example
|
|
260
|
-
* // 使用示例
|
|
261
|
-
* await functionName(options);
|
|
262
|
-
*/
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### 3. 错误处理规范
|
|
266
|
-
```javascript
|
|
267
|
-
// ✅ 统一的错误处理
|
|
268
|
-
try {
|
|
269
|
-
await riskyOperation();
|
|
270
|
-
} catch (error) {
|
|
271
|
-
// 记录详细错误信息
|
|
272
|
-
console.error(chalk.red('操作失败:'), error.message);
|
|
273
|
-
|
|
274
|
-
// 提供解决建议
|
|
275
|
-
if (error.code === 'ENOENT') {
|
|
276
|
-
console.log(chalk.yellow('建议: 检查文件路径是否正确'));
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// 重新抛出错误供上层处理
|
|
280
|
-
throw error;
|
|
281
|
-
}
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
### 4. 异步操作规范
|
|
285
|
-
```javascript
|
|
286
|
-
// ✅ 使用 async/await
|
|
287
|
-
async function performAsyncOperation() {
|
|
288
|
-
try {
|
|
289
|
-
const result = await someAsyncFunction();
|
|
290
|
-
return result;
|
|
291
|
-
} catch (error) {
|
|
292
|
-
throw new Error(`异步操作失败: ${error.message}`);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// ✅ 并行操作
|
|
297
|
-
async function performParallelOperations() {
|
|
298
|
-
const [result1, result2] = await Promise.all([
|
|
299
|
-
operation1(),
|
|
300
|
-
operation2()
|
|
301
|
-
]);
|
|
302
|
-
return { result1, result2 };
|
|
303
|
-
}
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## 🚨 错误处理规范
|
|
307
|
-
|
|
308
|
-
### 1. 错误类型分类
|
|
309
|
-
```javascript
|
|
310
|
-
// 参数错误
|
|
311
|
-
class ValidationError extends Error {
|
|
312
|
-
constructor(message) {
|
|
313
|
-
super(message);
|
|
314
|
-
this.name = 'ValidationError';
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// 网络错误
|
|
319
|
-
class NetworkError extends Error {
|
|
320
|
-
constructor(message) {
|
|
321
|
-
super(message);
|
|
322
|
-
this.name = 'NetworkError';
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// 业务逻辑错误
|
|
327
|
-
class BusinessError extends Error {
|
|
328
|
-
constructor(message) {
|
|
329
|
-
super(message);
|
|
330
|
-
this.name = 'BusinessError';
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
### 2. 错误处理模式
|
|
336
|
-
```javascript
|
|
337
|
-
async function execute(options) {
|
|
338
|
-
try {
|
|
339
|
-
// 参数验证
|
|
340
|
-
if (!options.param) {
|
|
341
|
-
throw new ValidationError('缺少必需参数');
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// 业务逻辑
|
|
345
|
-
const result = await performAction(options);
|
|
346
|
-
return result;
|
|
347
|
-
|
|
348
|
-
} catch (error) {
|
|
349
|
-
// 根据错误类型处理
|
|
350
|
-
if (error instanceof ValidationError) {
|
|
351
|
-
console.error(chalk.red('参数错误:'), error.message);
|
|
352
|
-
console.log(chalk.yellow('使用 --help 查看正确用法'));
|
|
353
|
-
} else if (error instanceof NetworkError) {
|
|
354
|
-
console.error(chalk.red('网络错误:'), error.message);
|
|
355
|
-
console.log(chalk.yellow('请检查网络连接'));
|
|
356
|
-
} else {
|
|
357
|
-
console.error(chalk.red('未知错误:'), error.message);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
throw error;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
## 🧪 测试规范
|
|
366
|
-
|
|
367
|
-
### 1. 测试文件结构
|
|
368
|
-
```
|
|
369
|
-
tests/
|
|
370
|
-
├── commands/
|
|
371
|
-
│ ├── build.test.js
|
|
372
|
-
│ ├── lang.test.js
|
|
373
|
-
│ └── upgrade.test.js
|
|
374
|
-
├── utils/
|
|
375
|
-
│ ├── git.test.js
|
|
376
|
-
│ └── update-checker.test.js
|
|
377
|
-
└── fixtures/
|
|
378
|
-
└── test-data.json
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
### 2. 测试用例规范
|
|
382
|
-
```javascript
|
|
383
|
-
// tests/commands/example.test.js
|
|
384
|
-
const { execute } = require('../../lib/commands/example');
|
|
385
|
-
|
|
386
|
-
describe('Example Command', () => {
|
|
387
|
-
test('应该成功执行命令', async () => {
|
|
388
|
-
const options = { param: 'test' };
|
|
389
|
-
const result = await execute(options);
|
|
390
|
-
expect(result).toBeDefined();
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
test('应该处理参数错误', async () => {
|
|
394
|
-
const options = {};
|
|
395
|
-
await expect(execute(options)).rejects.toThrow('缺少必需参数');
|
|
396
|
-
});
|
|
397
|
-
});
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
## 📦 发布规范
|
|
401
|
-
|
|
402
|
-
### 1. 版本更新流程
|
|
403
|
-
1. 更新 `package.json` 版本号
|
|
404
|
-
2. 更新 `CHANGELOG.md` 记录变更
|
|
405
|
-
3. 更新 `README.md` 文档(如需要)
|
|
406
|
-
4. 提交代码并创建标签
|
|
407
|
-
5. 发布到 npm
|
|
408
|
-
|
|
409
|
-
### 2. 变更日志规范
|
|
410
|
-
```markdown
|
|
411
|
-
## [版本号] - 日期
|
|
412
|
-
|
|
413
|
-
### 新增
|
|
414
|
-
- 新功能描述
|
|
415
|
-
|
|
416
|
-
### 更改
|
|
417
|
-
- 功能改进描述
|
|
418
|
-
|
|
419
|
-
### 修复
|
|
420
|
-
- 问题修复描述
|
|
421
|
-
|
|
422
|
-
### 移除
|
|
423
|
-
- 移除功能描述
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
## ⚠️ 重要注意事项
|
|
427
|
-
|
|
428
|
-
### 1. 自动更新检查机制
|
|
429
|
-
- **所有新命令都会自动获得后台更新检查功能**
|
|
430
|
-
- 无需手动实现更新检查逻辑
|
|
431
|
-
- 系统会在命令执行时自动检查并提醒用户更新
|
|
432
|
-
- `upgrade` 命令本身不会触发更新提醒
|
|
433
|
-
|
|
434
|
-
### 2. 命令执行流程
|
|
435
|
-
```javascript
|
|
436
|
-
// 每个命令执行时都会经过以下流程:
|
|
437
|
-
// 1. 启动后台更新检查(异步)
|
|
438
|
-
// 2. 检查并显示更新提醒(如有新版本)
|
|
439
|
-
// 3. 执行具体命令逻辑
|
|
440
|
-
// 4. 返回执行结果
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
### 3. 必须遵循的规则
|
|
444
|
-
- **不要修改主程序中的更新检查逻辑**
|
|
445
|
-
- **不要重复实现更新检查功能**
|
|
446
|
-
- **确保命令不会干扰更新检查机制**
|
|
447
|
-
- **长时间运行的命令要支持中断**
|
|
448
|
-
|
|
449
|
-
### 4. 命令开发限制
|
|
450
|
-
- 避免在命令中直接调用 `process.exit()`
|
|
451
|
-
- 不要阻塞主事件循环
|
|
452
|
-
- 网络请求必须设置超时时间
|
|
453
|
-
- 文件操作要处理权限错误
|
|
454
|
-
|
|
455
|
-
### 5. 性能考虑
|
|
456
|
-
- 命令执行时间应控制在合理范围内
|
|
457
|
-
- 大量数据处理要显示进度
|
|
458
|
-
- 避免内存泄漏
|
|
459
|
-
- 合理使用缓存
|
|
460
|
-
|
|
461
|
-
## ❓ 常见问题
|
|
462
|
-
|
|
463
|
-
### Q1: 如何添加新的命令选项?
|
|
464
|
-
A: 在命令注册时添加 `.option()` 调用,在命令实现中处理该选项。
|
|
465
|
-
|
|
466
|
-
### Q2: 如何处理异步操作?
|
|
467
|
-
A: 使用 `async/await` 语法,确保错误被正确捕获和处理。
|
|
468
|
-
|
|
469
|
-
### Q3: 如何添加子命令?
|
|
470
|
-
A: 使用 `program.command()` 创建父命令,然后使用 `.command()` 添加子命令。
|
|
471
|
-
|
|
472
|
-
### Q4: 如何确保命令的向后兼容性?
|
|
473
|
-
A: 避免删除现有选项,使用弃用警告而不是直接删除。
|
|
474
|
-
|
|
475
|
-
### Q5: 如何处理网络请求?
|
|
476
|
-
A: 使用 `axios` 库,设置合理的超时时间,添加错误处理。
|
|
477
|
-
|
|
478
|
-
### Q6: 新命令会自动获得更新检查功能吗?
|
|
479
|
-
A: 是的,所有新命令都会自动获得后台更新检查功能,无需手动实现。
|
|
480
|
-
|
|
481
|
-
### Q7: 如何确保命令不会干扰更新检查?
|
|
482
|
-
A: 不要修改主程序中的更新检查逻辑,不要重复实现更新检查功能。
|
|
483
|
-
|
|
484
|
-
## 🔧 开发工具推荐
|
|
485
|
-
|
|
486
|
-
### 代码质量工具
|
|
487
|
-
- ESLint: 代码风格检查
|
|
488
|
-
- Prettier: 代码格式化
|
|
489
|
-
- Jest: 单元测试
|
|
490
|
-
|
|
491
|
-
### 调试工具
|
|
492
|
-
- Node.js 内置调试器
|
|
493
|
-
- VS Code 调试配置
|
|
494
|
-
- 日志输出工具
|
|
495
|
-
|
|
496
|
-
## 📚 参考资源
|
|
497
|
-
|
|
498
|
-
- [Commander.js 文档](https://github.com/tj/commander.js)
|
|
499
|
-
- [Node.js 最佳实践](https://github.com/goldbergyoni/nodebestpractices)
|
|
500
|
-
- [语义化版本规范](https://semver.org/lang/zh-CN/)
|
|
501
|
-
|
|
502
|
-
---
|
|
503
|
-
|
|
504
|
-
**注意**: 本文档会随着项目发展持续更新,请确保使用最新版本。
|