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/index.js
CHANGED
|
@@ -1398,18 +1398,21 @@ var ModuleManager = class {
|
|
|
1398
1398
|
return this.MODULES.find((m) => m.id === id);
|
|
1399
1399
|
}
|
|
1400
1400
|
/**
|
|
1401
|
-
*
|
|
1401
|
+
* 注入模块到项目,返回新增文件列表
|
|
1402
1402
|
*/
|
|
1403
1403
|
static async injectModule(projectPath, moduleId, templatesDir) {
|
|
1404
1404
|
const module = this.getModuleById(moduleId);
|
|
1405
|
-
if (!module) return;
|
|
1405
|
+
if (!module) return [];
|
|
1406
|
+
const addedFiles = [];
|
|
1406
1407
|
for (const specRelPath of module.specs) {
|
|
1407
1408
|
const sourcePath = path5.join(templatesDir, "modules", specRelPath);
|
|
1408
1409
|
const targetPath = path5.join(projectPath, "docs/specs", path5.basename(specRelPath));
|
|
1409
1410
|
if (await FileUtils.exists(sourcePath)) {
|
|
1410
1411
|
await FileUtils.copy(sourcePath, targetPath);
|
|
1412
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
1411
1413
|
} else if (module.type === "remote") {
|
|
1412
1414
|
await this.generateRemoteSpecPlaceholder(targetPath, module);
|
|
1415
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
1413
1416
|
}
|
|
1414
1417
|
}
|
|
1415
1418
|
if (module.type === "local" && module.backendFragments) {
|
|
@@ -1422,11 +1425,13 @@ var ModuleManager = class {
|
|
|
1422
1425
|
if (await FileUtils.exists(sourcePath)) {
|
|
1423
1426
|
await FileUtils.ensureDir(path5.dirname(targetPath));
|
|
1424
1427
|
await FileUtils.copy(sourcePath, targetPath);
|
|
1428
|
+
addedFiles.push(path5.relative(projectPath, targetPath));
|
|
1425
1429
|
}
|
|
1426
1430
|
}
|
|
1427
1431
|
}
|
|
1428
1432
|
} else if (module.type === "remote") {
|
|
1429
1433
|
}
|
|
1434
|
+
return addedFiles;
|
|
1430
1435
|
}
|
|
1431
1436
|
/**
|
|
1432
1437
|
* 生成远程模块的 Spec 占位符
|
|
@@ -1561,11 +1566,13 @@ var initCommand = new Command("init").argument("[project-name]", "\u9879\u76EE\u
|
|
|
1561
1566
|
},
|
|
1562
1567
|
{
|
|
1563
1568
|
title: "\u6CE8\u5165\u9009\u5B9A\u7684\u901A\u7528\u6A21\u5757",
|
|
1564
|
-
task: async () => {
|
|
1569
|
+
task: async (ctx) => {
|
|
1565
1570
|
if (selectedModules.length === 0) return;
|
|
1566
1571
|
const templatesDir = path7.resolve(FileUtils.getDirName(import.meta.url), "../templates");
|
|
1572
|
+
ctx.addedFiles = [];
|
|
1567
1573
|
for (const moduleId of selectedModules) {
|
|
1568
|
-
await ModuleManager.injectModule(projectPath, moduleId, templatesDir);
|
|
1574
|
+
const files = await ModuleManager.injectModule(projectPath, moduleId, templatesDir);
|
|
1575
|
+
ctx.addedFiles.push(...files);
|
|
1569
1576
|
}
|
|
1570
1577
|
}
|
|
1571
1578
|
},
|
|
@@ -1580,7 +1587,7 @@ var initCommand = new Command("init").argument("[project-name]", "\u9879\u76EE\u
|
|
|
1580
1587
|
],
|
|
1581
1588
|
{ concurrent: false, exitOnError: true }
|
|
1582
1589
|
);
|
|
1583
|
-
await tasks.run();
|
|
1590
|
+
const taskContext = await tasks.run();
|
|
1584
1591
|
const remoteModules = selectedModules.map((id) => ModuleManager.getModuleById(id)).filter((m) => m?.type === "remote");
|
|
1585
1592
|
if (remoteModules.length > 0) {
|
|
1586
1593
|
logger.newLine();
|
|
@@ -1617,10 +1624,14 @@ var initCommand = new Command("init").argument("[project-name]", "\u9879\u76EE\u
|
|
|
1617
1624
|
prompt,
|
|
1618
1625
|
"--add-dir",
|
|
1619
1626
|
projectPath,
|
|
1620
|
-
"--dangerously-skip-permissions"
|
|
1627
|
+
"--dangerously-skip-permissions",
|
|
1628
|
+
"--output-format",
|
|
1629
|
+
"text"
|
|
1621
1630
|
], {
|
|
1622
1631
|
stdio: "inherit",
|
|
1623
|
-
timeout: 6e5
|
|
1632
|
+
timeout: 6e5,
|
|
1633
|
+
env: { ...process.env, FORCE_COLOR: "1" }
|
|
1634
|
+
// 保持颜色输出
|
|
1624
1635
|
});
|
|
1625
1636
|
logger.success(`[${module.name}] \u4EE3\u7801\u751F\u6210\u5B8C\u6210`);
|
|
1626
1637
|
} catch (err) {
|
|
@@ -1635,6 +1646,15 @@ var initCommand = new Command("init").argument("[project-name]", "\u9879\u76EE\u
|
|
|
1635
1646
|
logger.newLine();
|
|
1636
1647
|
logger.success(`\u9879\u76EE ${projectName} \u521D\u59CB\u5316\u6210\u529F\uFF01`);
|
|
1637
1648
|
logger.newLine();
|
|
1649
|
+
const addedFiles = taskContext?.addedFiles || [];
|
|
1650
|
+
if (addedFiles.length > 0) {
|
|
1651
|
+
logger.newLine();
|
|
1652
|
+
logger.header("\u6A21\u5757\u65B0\u589E\u6587\u4EF6\u6C47\u603B");
|
|
1653
|
+
for (const file of addedFiles) {
|
|
1654
|
+
logger.step(file);
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
logger.newLine();
|
|
1638
1658
|
logger.info("\u4E0B\u4E00\u6B65:");
|
|
1639
1659
|
logger.step(`cd ${projectName}`);
|
|
1640
1660
|
logger.step("team-cli add-feature <feature-name>");
|