@xubill/xx-cli 1.0.3 → 1.0.5

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/core/index.js CHANGED
@@ -3,13 +3,11 @@
3
3
  * 负责初始化系统、注册命令、管理插件等
4
4
  */
5
5
 
6
- const fs = require('fs');
7
- const path = require('path');
8
- const logger = require('../utils/logger');
9
- const pkg = require('../../package.json');
10
- const validator = require('../utils/validator');
11
- const pluginConfig = require('../utils/plugin-config');
12
- const coreCommands = require('./commands');
6
+ const fs = require("fs");
7
+ const path = require("path");
8
+ const logger = require("../utils/logger");
9
+ const pkg = require("../../package.json");
10
+ const pluginConfig = require("../utils/plugin-config");
13
11
 
14
12
  class Core {
15
13
  constructor() {
@@ -27,10 +25,10 @@ class Core {
27
25
  async init() {
28
26
  //logger.info('正在初始化 xx 核心...');
29
27
  this.loadPlugins();
30
-
28
+
31
29
  // 触发初始化完成钩子
32
- await this.triggerHook('init', { core: this });
33
-
30
+ await this.triggerHook("init", { core: this });
31
+
34
32
  //logger.info('xx 核心初始化完成');
35
33
  }
36
34
 
@@ -38,12 +36,37 @@ class Core {
38
36
  * 加载插件
39
37
  */
40
38
  loadPlugins() {
41
- const pluginsDir = path.join(__dirname, '../plugins');
42
- if (fs.existsSync(pluginsDir)) {
43
- const pluginFiles = fs.readdirSync(pluginsDir);
44
- // 只收集插件文件信息,不立即加载
45
- this.pluginFiles = pluginFiles.filter(file => file.endsWith('.js'));
39
+ // 内置插件目录(会被重新安装覆盖)
40
+ const builtinPluginsDir = path.join(__dirname, "../plugins");
41
+ // 用户插件目录(不会被重新安装影响)
42
+ const userPluginsDir = path.join(
43
+ process.env.HOME || process.env.USERPROFILE,
44
+ ".xx-cli",
45
+ "plugins"
46
+ );
47
+
48
+ // 确保用户插件目录存在
49
+ if (!fs.existsSync(userPluginsDir)) {
50
+ fs.mkdirSync(userPluginsDir, { recursive: true });
51
+ }
52
+
53
+ // 收集内置插件
54
+ let pluginFiles = [];
55
+ if (fs.existsSync(builtinPluginsDir)) {
56
+ const builtinFiles = fs.readdirSync(builtinPluginsDir);
57
+ pluginFiles = builtinFiles.filter((file) => file.endsWith(".js"));
58
+ }
59
+
60
+ // 收集用户插件
61
+ if (fs.existsSync(userPluginsDir)) {
62
+ const userFiles = fs.readdirSync(userPluginsDir);
63
+ const userPluginFiles = userFiles.filter((file) => file.endsWith(".js"));
64
+ // 将用户插件添加到插件文件列表中
65
+ pluginFiles = [...pluginFiles, ...userPluginFiles];
46
66
  }
67
+
68
+ // 只收集插件文件信息,不立即加载
69
+ this.pluginFiles = pluginFiles;
47
70
  }
48
71
  /**
49
72
  * 加载单个插件
@@ -55,23 +78,73 @@ class Core {
55
78
  if (this.pluginCache.has(pluginFile)) {
56
79
  return this.pluginCache.get(pluginFile);
57
80
  }
58
-
59
- const pluginPath = path.join(__dirname, '../plugins', pluginFile);
81
+
82
+ // 内置插件目录
83
+ const builtinPluginsDir = path.join(__dirname, "../plugins");
84
+ // 用户插件目录
85
+ const userPluginsDir = path.join(
86
+ process.env.HOME || process.env.USERPROFILE,
87
+ ".xx-cli",
88
+ "plugins"
89
+ );
90
+
91
+ // 优先从内置插件目录加载
92
+ let pluginPath = path.join(builtinPluginsDir, pluginFile);
93
+
94
+ // 如果内置插件目录中不存在,则从用户插件目录加载
95
+ if (!fs.existsSync(pluginPath)) {
96
+ pluginPath = path.join(userPluginsDir, pluginFile);
97
+ }
98
+
99
+ // 如果两个目录中都不存在,则返回null
100
+ if (!fs.existsSync(pluginPath)) {
101
+ logger.error(`插件文件 ${pluginFile} 不存在`);
102
+ return null;
103
+ }
104
+
60
105
  try {
61
- const Plugin = require(pluginPath);
62
-
106
+ // 读取插件文件内容
107
+ let pluginContent = fs.readFileSync(pluginPath, "utf8");
108
+
109
+ // 替换插件文件中的相对路径导入为绝对路径导入
110
+ // 替换 ../core 为绝对路径
111
+ const coreDir = path.join(__dirname, "../core");
112
+ pluginContent = pluginContent.replace(
113
+ /require\('\.\.\/core\//g,
114
+ `require('${coreDir}/`
115
+ );
116
+
117
+ // 替换 ../utils 为绝对路径
118
+ const utilsDir = path.join(__dirname, "../utils");
119
+ pluginContent = pluginContent.replace(
120
+ /require\('\.\.\/utils\//g,
121
+ `require('${utilsDir}/`
122
+ );
123
+
124
+ // 创建一个临时模块来加载修改后的插件内容
125
+ const Module = require("module");
126
+ const tempModule = new Module(pluginPath);
127
+ tempModule.filename = pluginPath;
128
+ tempModule.paths = module.paths;
129
+
130
+ // 编译并执行修改后的插件内容
131
+ tempModule._compile(pluginContent, pluginPath);
132
+
133
+ const Plugin = tempModule.exports;
134
+
63
135
  // 检查是否为类
64
- if (typeof Plugin === 'function' && Plugin.prototype) {
136
+ if (typeof Plugin === "function" && Plugin.prototype) {
65
137
  // 实例化类插件
66
138
  const pluginInstance = new Plugin();
67
- pluginInstance.pluginName = pluginInstance.pluginName || pluginFile.replace('.js', '');
68
-
139
+ pluginInstance.pluginName =
140
+ pluginInstance.pluginName || pluginFile.replace(".js", "");
141
+
69
142
  // 缓存插件实例
70
143
  this.pluginCache.set(pluginFile, pluginInstance);
71
144
  return pluginInstance;
72
145
  } else {
73
146
  // 保持非类插件的兼容性
74
-
147
+
75
148
  // 缓存插件
76
149
  this.pluginCache.set(pluginFile, Plugin);
77
150
  return Plugin;
@@ -86,11 +159,11 @@ class Core {
86
159
  * @returns {Array} 插件信息数组
87
160
  */
88
161
  getPluginsInfo() {
89
- return this.pluginFiles.map(pluginFile => {
90
- const pluginName = pluginFile.replace('.js', '');
162
+ return this.pluginFiles.map((pluginFile) => {
163
+ const pluginName = pluginFile.replace(".js", "");
91
164
  return {
92
165
  name: pluginName,
93
- file: pluginFile
166
+ file: pluginFile,
94
167
  };
95
168
  });
96
169
  }
@@ -102,24 +175,33 @@ class Core {
102
175
  registerCommands(program) {
103
176
  // 注册核心命令
104
177
  this.registerCoreCommands(program);
105
-
178
+
106
179
  // 注册插件命令
107
180
  if (this.pluginFiles) {
108
- this.pluginFiles.forEach(pluginFile => {
109
- const pluginName = pluginFile.replace('.js', '');
110
-
181
+ this.pluginFiles.forEach((pluginFile) => {
182
+ const pluginName = pluginFile.replace(".js", "");
183
+
111
184
  // 检查插件是否已禁用
112
185
  if (pluginConfig.isPluginDisabled(pluginName)) {
113
186
  return;
114
187
  }
115
-
188
+
116
189
  const plugin = this.loadPlugin(pluginFile);
117
190
  if (plugin && plugin.registerCommands) {
118
- plugin.registerCommands(program);
191
+ try {
192
+ plugin.registerCommands(program);
193
+ } catch (error) {
194
+ // 捕获命令别名冲突等错误,确保其他插件能够正常注册
195
+ if (error.message && error.message.includes('cannot add alias')) {
196
+ console.warn(`警告: 插件 ${pluginName} 的命令别名与其他插件冲突,已跳过此插件的命令注册`);
197
+ } else {
198
+ console.error(`错误: 插件 ${pluginName} 注册命令失败: ${error.message}`);
199
+ }
200
+ }
119
201
  }
120
202
  });
121
203
  }
122
-
204
+
123
205
  // 注册命令自动建议功能
124
206
  this.registerCommandSuggestions(program);
125
207
  }
@@ -131,18 +213,18 @@ class Core {
131
213
  registerCommandSuggestions(program) {
132
214
  // 收集所有命令信息
133
215
  const allCommands = this.collectAllCommands(program);
134
-
216
+
135
217
  // 添加命令自动建议
136
- program.on('command:*', (args) => {
218
+ program.on("command:*", (args) => {
137
219
  const inputCommand = args[0];
138
220
  const suggestions = this.getCommandSuggestions(inputCommand, allCommands);
139
-
221
+
140
222
  if (suggestions.length > 0) {
141
223
  console.log(`\n未找到命令 "${inputCommand}",您可能想要:`);
142
- suggestions.forEach(suggestion => {
224
+ suggestions.forEach((suggestion) => {
143
225
  console.log(` - ${suggestion}`);
144
226
  });
145
- console.log('');
227
+ console.log("");
146
228
  process.exit(1);
147
229
  }
148
230
  });
@@ -155,22 +237,22 @@ class Core {
155
237
  */
156
238
  collectAllCommands(program) {
157
239
  const commands = [];
158
-
240
+
159
241
  // 收集核心命令
160
242
  if (program.commands) {
161
- program.commands.forEach(command => {
243
+ program.commands.forEach((command) => {
162
244
  // 添加命令名称
163
- if (command._name && command._name !== '*') {
245
+ if (command._name && command._name !== "*") {
164
246
  commands.push(command._name);
165
247
  }
166
-
248
+
167
249
  // 添加命令别名
168
250
  if (command._alias) {
169
251
  commands.push(command._alias);
170
252
  }
171
253
  });
172
254
  }
173
-
255
+
174
256
  return commands;
175
257
  }
176
258
 
@@ -181,9 +263,11 @@ class Core {
181
263
  * @returns {Array} 建议的命令数组
182
264
  */
183
265
  getCommandSuggestions(input, commands) {
184
- return commands.filter(command => {
185
- return command.startsWith(input.toLowerCase());
186
- }).slice(0, 5); // 最多返回5个建议
266
+ return commands
267
+ .filter((command) => {
268
+ return command.startsWith(input.toLowerCase());
269
+ })
270
+ .slice(0, 5); // 最多返回5个建议
187
271
  }
188
272
 
189
273
  /**
@@ -195,7 +279,7 @@ class Core {
195
279
  if (!this.hooks[event]) {
196
280
  this.hooks[event] = [];
197
281
  }
198
-
282
+
199
283
  this.hooks[event].push(callback);
200
284
  }
201
285
 
@@ -207,7 +291,7 @@ class Core {
207
291
  */
208
292
  async triggerHook(event, data) {
209
293
  const results = [];
210
-
294
+
211
295
  // 触发全局钩子
212
296
  if (this.hooks[event]) {
213
297
  for (const callback of this.hooks[event]) {
@@ -219,29 +303,32 @@ class Core {
219
303
  }
220
304
  }
221
305
  }
222
-
306
+
223
307
  // 触发所有插件的钩子
224
308
  if (this.pluginFiles) {
225
309
  for (const pluginFile of this.pluginFiles) {
226
- const pluginName = pluginFile.replace('.js', '');
227
-
310
+ const pluginName = pluginFile.replace(".js", "");
311
+
228
312
  // 检查插件是否已禁用
229
313
  if (pluginConfig.isPluginDisabled(pluginName)) {
230
314
  continue;
231
315
  }
232
-
316
+
233
317
  const plugin = this.loadPlugin(pluginFile);
234
318
  if (plugin && plugin.triggerHook) {
235
319
  try {
236
320
  const pluginResults = await plugin.triggerHook(event, data);
237
321
  results.push(...pluginResults);
238
322
  } catch (error) {
239
- console.error(`执行插件 ${pluginName} 的钩子 ${event} 时出错:`, error.message);
323
+ console.error(
324
+ `执行插件 ${pluginName} 的钩子 ${event} 时出错:`,
325
+ error.message
326
+ );
240
327
  }
241
328
  }
242
329
  }
243
330
  }
244
-
331
+
245
332
  return results;
246
333
  }
247
334
 
@@ -254,54 +341,6 @@ class Core {
254
341
  return this.hooks[event] && this.hooks[event].length > 0;
255
342
  }
256
343
 
257
- /**
258
- * 显示命令历史记录
259
- * @param {Object} options - 选项
260
- */
261
- showHistory(options) {
262
- const historyManager = require('../utils/history-manager');
263
-
264
- if (options.clear) {
265
- // 清除命令历史记录
266
- historyManager.clearHistory();
267
- console.log('命令历史记录已清除');
268
- return;
269
- }
270
-
271
- if (options.search) {
272
- // 搜索命令历史记录
273
- const searchResults = historyManager.searchHistory(options.search);
274
- if (searchResults.length > 0) {
275
- console.log('\n搜索结果:');
276
- console.log('=====================================');
277
- searchResults.forEach((item, index) => {
278
- const date = new Date(item.timestamp).toLocaleString();
279
- console.log(`${index + 1}. ${item.command} (${date})`);
280
- });
281
- console.log('=====================================');
282
- console.log(`总计: ${searchResults.length} 条记录\n`);
283
- } else {
284
- console.log(`\n未找到匹配 "${options.search}" 的命令历史记录\n`);
285
- }
286
- return;
287
- }
288
-
289
- // 显示命令历史记录
290
- const history = historyManager.getHistory(options.limit);
291
- if (history.length > 0) {
292
- console.log('\n命令历史记录:');
293
- console.log('=====================================');
294
- history.forEach((item, index) => {
295
- const date = new Date(item.timestamp).toLocaleString();
296
- console.log(`${index + 1}. ${item.command} (${date})`);
297
- });
298
- console.log('=====================================');
299
- console.log(`总计: ${history.length} 条记录\n`);
300
- } else {
301
- console.log('\n命令历史记录为空\n');
302
- }
303
- }
304
-
305
344
  /**
306
345
  * 注册核心命令
307
346
  * @param {Object} program - Commander 实例
@@ -309,163 +348,20 @@ class Core {
309
348
  registerCoreCommands(program) {
310
349
  // 帮助命令
311
350
  program
312
- .command('help')
313
- .description('显示帮助信息')
351
+ .command("help")
352
+ .description("显示帮助信息")
314
353
  .action(() => {
315
354
  program.outputHelp();
316
355
  });
317
356
 
318
- // 版本命令
357
+ // 版本命令
319
358
  program
320
- .command('version')
321
- .alias('v')
322
- .description('显示版本信息')
359
+ .command("version")
360
+ .alias("v")
361
+ .description("显示版本信息")
323
362
  .action(() => {
324
363
  console.log(this.version);
325
364
  });
326
-
327
- // 命令历史记录
328
- program
329
- .command('history')
330
- .alias('h')
331
- .description('查看命令历史记录')
332
- .option('-l, --limit <number>', '限制显示的历史记录数量', parseInt, 10)
333
- .option('-c, --clear', '清除命令历史记录')
334
- .option('-s, --search <keyword>', '搜索命令历史记录')
335
- .action((options) => this.showHistory(options));
336
-
337
- // 创建插件命令
338
- program
339
- .command('create-plugin <name>')
340
- .alias('crp')
341
- .description('创建指定名称的插件模板')
342
- .action(async (name, options) => this.createPlugin(name, options));
343
-
344
- // 配置管理命令
345
- const configCommand = program.command('config-manager')
346
- .alias('conf')
347
- .description('管理所有插件的配置文件');
348
-
349
- // 导出配置命令
350
- configCommand.command('export [target]')
351
- .description('导出所有插件配置到指定目录,默认导出到当前目录的 config-backup 文件夹')
352
- .action((target) => this.configManager('export', target));
353
-
354
- // 导入配置命令
355
- configCommand.command('import [source]')
356
- .description('从指定目录导入配置并覆盖,默认从当前目录的 config-backup 文件夹导入')
357
- .action((source) => this.configManager('import', source));
358
-
359
- // 列出配置命令
360
- configCommand.command('list')
361
- .description('列出所有插件的配置文件位置和状态')
362
- .action(() => this.configManager('list'));
363
-
364
- // 插件管理命令
365
- const pluginCommand = program.command('plugin')
366
- .alias('p')
367
- .description('插件管理');
368
-
369
- // 列出插件
370
- pluginCommand.command('list')
371
- .alias('ls')
372
- .description('列出所有插件')
373
- .action(() => this.listPlugins());
374
-
375
- // 启用插件
376
- pluginCommand.command('enable <plugin>')
377
- .alias('en')
378
- .description('启用插件')
379
- .action((plugin) => this.enablePlugin(plugin));
380
-
381
- // 禁用插件
382
- pluginCommand.command('disable <plugin>')
383
- .alias('dis')
384
- .description('禁用插件')
385
- .action((plugin) => this.disablePlugin(plugin));
386
-
387
- // 添加外部自定义插件
388
- pluginCommand.command('add <url>')
389
- .description('添加外部自定义插件')
390
- .action((url) => this.addExternalPlugin(url));
391
-
392
- pluginCommand.command('remove <plugin>')
393
- .alias('rm')
394
- .description('删除指定插件')
395
- .action((plugin) => this.removePlugin(plugin));
396
-
397
- // 插件配置管理
398
- pluginCommand.command('config <plugin> [key] [value]')
399
- .alias('c')
400
- .description('查看和设置插件配置')
401
- .action((plugin, key, value) => this.managePluginConfig(plugin, key, value));
402
- }
403
-
404
- /**
405
- * 创建插件
406
- * @param {string} name - 插件名称
407
- * @param {Object} options - 选项
408
- */
409
- async createPlugin(name, options) {
410
- await coreCommands.createPlugin(name, options);
411
- }
412
-
413
- /**
414
- * 配置管理
415
- * @param {string} action - 操作类型
416
- * @param {string} target - 目标路径
417
- */
418
- configManager(action, target) {
419
- coreCommands.configManager(action, target);
420
- }
421
-
422
- /**
423
- * 列出所有插件
424
- */
425
- listPlugins() {
426
- coreCommands.listPlugins(this);
427
- }
428
-
429
- /**
430
- * 启用插件
431
- * @param {string} pluginName - 插件名称
432
- */
433
- enablePlugin(pluginName) {
434
- coreCommands.enablePlugin(pluginName);
435
- }
436
-
437
- /**
438
- * 禁用插件
439
- * @param {string} pluginName - 插件名称
440
- */
441
- disablePlugin(pluginName) {
442
- coreCommands.disablePlugin(pluginName);
443
- }
444
-
445
- /**
446
- * 删除插件
447
- * @param {string} pluginName - 插件名称
448
- */
449
- removePlugin(pluginName) {
450
- coreCommands.removePlugin(pluginName);
451
- }
452
-
453
- /**
454
- * 管理插件配置
455
- * @param {string} pluginName - 插件名称
456
- * @param {string} key - 配置键
457
- * @param {string} value - 配置值
458
- */
459
- managePluginConfig(pluginName, key, value) {
460
- coreCommands.managePluginConfig(pluginName, key, value);
461
- }
462
-
463
- /**
464
- * 添加外部自定义插件
465
- * @param {string} url - 插件URL或本地文件路径
466
- */
467
- async addExternalPlugin(url) {
468
- await coreCommands.addExternalPlugin(url);
469
365
  }
470
366
  }
471
367
 
@@ -0,0 +1,140 @@
1
+ /**
2
+ * 配置管理插件
3
+ * 用于管理所有插件的配置文件
4
+ *
5
+ * 命令说明:
6
+ * - config-manager [options]:管理所有插件的配置文件
7
+ * - 示例:config-manager export
8
+ * - 示例:config-manager import
9
+ * - 示例:config-manager list
10
+ *
11
+ * 功能说明:
12
+ * - 导出所有插件配置到指定目录
13
+ * - 从指定目录导入配置并覆盖
14
+ * - 列出所有插件的配置文件位置和状态
15
+ *
16
+ * 用户体验:
17
+ * - 使用标准化的用户提示
18
+ * - 提供清晰的错误提示
19
+ * - 支持命令行参数
20
+ */
21
+
22
+ const fs = require('fs-extra');
23
+ const path = require('path');
24
+ const BasePlugin = require('../core/base-plugin');
25
+
26
+ class ConfigManagerPlugin extends BasePlugin {
27
+ constructor(options = {}) {
28
+ super(options);
29
+ this.pluginName = 'config-manager';
30
+ }
31
+
32
+ /**
33
+ * 注册命令
34
+ * @param {Object} program - Commander.js 实例
35
+ */
36
+ registerCommands(program) {
37
+ // 配置管理命令
38
+ const configCommand = program.command('config-manager')
39
+ .alias('conf')
40
+ .description('管理所有插件的配置文件');
41
+
42
+ // 导出配置命令
43
+ configCommand.command('export [target]')
44
+ .description('导出所有插件配置到指定目录,默认导出到当前目录的 config-backup 文件夹')
45
+ .action((target) => this.exportConfig(target));
46
+
47
+ // 导入配置命令
48
+ configCommand.command('import [source]')
49
+ .description('从指定目录导入配置并覆盖,默认从当前目录的 config-backup 文件夹导入')
50
+ .action((source) => this.importConfig(source));
51
+
52
+ // 列出配置命令
53
+ configCommand.command('list')
54
+ .description('列出所有插件的配置文件位置和状态')
55
+ .action(() => this.listConfig());
56
+ }
57
+
58
+ /**
59
+ * 导出配置
60
+ * @param {string} target - 目标路径
61
+ */
62
+ exportConfig(target) {
63
+ const homeDir = process.env.HOME || process.env.USERPROFILE;
64
+ const xxDir = path.join(homeDir, '.xx-cli');
65
+ const exportDir = target || path.join(process.cwd(), 'config-backup');
66
+ console.log(`开始导出配置到: ${exportDir}`);
67
+
68
+ // 确保导出目录存在
69
+ fs.ensureDirSync(exportDir);
70
+
71
+ // 复制 .xx 目录
72
+ if (fs.existsSync(xxDir)) {
73
+ const exportPath = path.join(exportDir, '.xx-cli');
74
+ fs.ensureDirSync(path.dirname(exportPath));
75
+ fs.copySync(xxDir, exportPath);
76
+ console.log(`导出目录: ${xxDir}`);
77
+ }
78
+
79
+ console.log('配置导出完成!');
80
+ }
81
+
82
+ /**
83
+ * 导入配置
84
+ * @param {string} source - 源路径
85
+ */
86
+ importConfig(source) {
87
+ const homeDir = process.env.HOME || process.env.USERPROFILE;
88
+ const xxDir = path.join(homeDir, '.xx-cli');
89
+ const importDir = source || path.join(process.cwd(), 'config-backup');
90
+ console.log(`开始从 ${importDir} 导入配置...`);
91
+
92
+ // 检查导入目录是否存在
93
+ if (!fs.existsSync(importDir)) {
94
+ console.log(`导入目录不存在: ${importDir}`);
95
+ return;
96
+ }
97
+
98
+ // 复制配置到 .xx 目录
99
+ const importPath = path.join(importDir, '.xx-cli');
100
+ if (fs.existsSync(importPath)) {
101
+ fs.ensureDirSync(path.dirname(xxDir));
102
+ fs.copySync(importPath, xxDir, { overwrite: true });
103
+ console.log(`导入目录: ${importPath}`);
104
+ }
105
+
106
+ console.log('配置导入完成!');
107
+ }
108
+
109
+ /**
110
+ * 列出配置
111
+ */
112
+ listConfig() {
113
+ const homeDir = process.env.HOME || process.env.USERPROFILE;
114
+ const xxDir = path.join(homeDir, '.xx-cli');
115
+ console.log('列出所有插件配置文件...\n');
116
+
117
+ if (fs.existsSync(xxDir)) {
118
+ const items = fs.readdirSync(xxDir).filter(item => !item.startsWith('.') && item !== 'plugins');
119
+ items.forEach(item => {
120
+ const itemPath = path.join(xxDir, item);
121
+ const stat = fs.statSync(itemPath);
122
+ if (stat.isDirectory()) {
123
+ console.log(`插件配置目录: ${itemPath}`);
124
+ const configFiles = fs.readdirSync(itemPath).filter(file => !file.startsWith('.'));
125
+ configFiles.forEach(file => {
126
+ console.log(` - ${file}`);
127
+ });
128
+ } else if (stat.isFile()) {
129
+ console.log(`配置文件: ${itemPath}`);
130
+ }
131
+ });
132
+ } else {
133
+ console.log('配置目录不存在');
134
+ }
135
+
136
+ console.log('配置列表完成!');
137
+ }
138
+ }
139
+
140
+ module.exports = ConfigManagerPlugin;