yg-team-cli 2.3.8 → 2.3.10
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/dist/cli.js +27 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -958,18 +958,21 @@ var init_module_registry = __esm({
|
|
|
958
958
|
return this.MODULES.find((m) => m.id === id);
|
|
959
959
|
}
|
|
960
960
|
/**
|
|
961
|
-
*
|
|
961
|
+
* 注入模块到项目,返回新增文件列表
|
|
962
962
|
*/
|
|
963
963
|
static async injectModule(projectPath, moduleId, templatesDir) {
|
|
964
964
|
const module = this.getModuleById(moduleId);
|
|
965
|
-
if (!module) return;
|
|
965
|
+
if (!module) return [];
|
|
966
|
+
const addedFiles = [];
|
|
966
967
|
for (const specRelPath of module.specs) {
|
|
967
968
|
const sourcePath = path5.join(templatesDir, "modules", specRelPath);
|
|
968
969
|
const targetPath = path5.join(projectPath, "docs/specs", path5.basename(specRelPath));
|
|
969
970
|
if (await FileUtils.exists(sourcePath)) {
|
|
970
971
|
await FileUtils.copy(sourcePath, targetPath);
|
|
972
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
971
973
|
} else if (module.type === "remote") {
|
|
972
974
|
await this.generateRemoteSpecPlaceholder(targetPath, module);
|
|
975
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
973
976
|
}
|
|
974
977
|
}
|
|
975
978
|
if (module.type === "local" && module.backendFragments) {
|
|
@@ -982,11 +985,13 @@ var init_module_registry = __esm({
|
|
|
982
985
|
if (await FileUtils.exists(sourcePath)) {
|
|
983
986
|
await FileUtils.ensureDir(path5.dirname(targetPath));
|
|
984
987
|
await FileUtils.copy(sourcePath, targetPath);
|
|
988
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
985
989
|
}
|
|
986
990
|
}
|
|
987
991
|
}
|
|
988
992
|
} else if (module.type === "remote") {
|
|
989
993
|
}
|
|
994
|
+
return addedFiles;
|
|
990
995
|
}
|
|
991
996
|
/**
|
|
992
997
|
* 生成远程模块的 Spec 占位符
|
|
@@ -2263,11 +2268,13 @@ var init_init = __esm({
|
|
|
2263
2268
|
},
|
|
2264
2269
|
{
|
|
2265
2270
|
title: "\u6CE8\u5165\u9009\u5B9A\u7684\u901A\u7528\u6A21\u5757",
|
|
2266
|
-
task: async () => {
|
|
2271
|
+
task: async (ctx) => {
|
|
2267
2272
|
if (selectedModules.length === 0) return;
|
|
2268
2273
|
const templatesDir = path7.resolve(FileUtils.getDirName(import.meta.url), "../templates");
|
|
2274
|
+
ctx.addedFiles = [];
|
|
2269
2275
|
for (const moduleId of selectedModules) {
|
|
2270
|
-
await ModuleManager.injectModule(projectPath, moduleId, templatesDir);
|
|
2276
|
+
const files = await ModuleManager.injectModule(projectPath, moduleId, templatesDir);
|
|
2277
|
+
ctx.addedFiles.push(...files);
|
|
2271
2278
|
}
|
|
2272
2279
|
}
|
|
2273
2280
|
},
|
|
@@ -2282,7 +2289,7 @@ var init_init = __esm({
|
|
|
2282
2289
|
],
|
|
2283
2290
|
{ concurrent: false, exitOnError: true }
|
|
2284
2291
|
);
|
|
2285
|
-
await tasks.run();
|
|
2292
|
+
const taskContext = await tasks.run();
|
|
2286
2293
|
const remoteModules = selectedModules.map((id) => ModuleManager.getModuleById(id)).filter((m) => m?.type === "remote");
|
|
2287
2294
|
if (remoteModules.length > 0) {
|
|
2288
2295
|
logger.newLine();
|
|
@@ -2319,10 +2326,14 @@ var init_init = __esm({
|
|
|
2319
2326
|
prompt,
|
|
2320
2327
|
"--add-dir",
|
|
2321
2328
|
projectPath,
|
|
2322
|
-
"--dangerously-skip-permissions"
|
|
2329
|
+
"--dangerously-skip-permissions",
|
|
2330
|
+
"--output-format",
|
|
2331
|
+
"text"
|
|
2323
2332
|
], {
|
|
2324
2333
|
stdio: "inherit",
|
|
2325
|
-
timeout: 6e5
|
|
2334
|
+
timeout: 6e5,
|
|
2335
|
+
env: { ...process.env, FORCE_COLOR: "1" }
|
|
2336
|
+
// 保持颜色输出
|
|
2326
2337
|
});
|
|
2327
2338
|
logger.success(`[${module.name}] \u4EE3\u7801\u751F\u6210\u5B8C\u6210`);
|
|
2328
2339
|
} catch (err) {
|
|
@@ -2337,6 +2348,15 @@ var init_init = __esm({
|
|
|
2337
2348
|
logger.newLine();
|
|
2338
2349
|
logger.success(`\u9879\u76EE ${projectName} \u521D\u59CB\u5316\u6210\u529F\uFF01`);
|
|
2339
2350
|
logger.newLine();
|
|
2351
|
+
const addedFiles = taskContext?.addedFiles || [];
|
|
2352
|
+
if (addedFiles.length > 0) {
|
|
2353
|
+
logger.newLine();
|
|
2354
|
+
logger.header("\u6A21\u5757\u65B0\u589E\u6587\u4EF6\u6C47\u603B");
|
|
2355
|
+
for (const file of addedFiles) {
|
|
2356
|
+
logger.step(file);
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
logger.newLine();
|
|
2340
2360
|
logger.info("\u4E0B\u4E00\u6B65:");
|
|
2341
2361
|
logger.step(`cd ${projectName}`);
|
|
2342
2362
|
logger.step("team-cli add-feature <feature-name>");
|