create-csch5-monorepo 1.0.0 → 1.0.2
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/bin/index.js +1 -0
- package/lib/commands/update.js +23 -3
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -23,6 +23,7 @@ program
|
|
|
23
23
|
.command('update')
|
|
24
24
|
.description('Update shared packages and configurations')
|
|
25
25
|
.option('--check', 'Only check for updates')
|
|
26
|
+
.option('-p, --package <name>', 'Update specific package only (e.g., bridge, utils, request)')
|
|
26
27
|
.action(update);
|
|
27
28
|
|
|
28
29
|
program
|
package/lib/commands/update.js
CHANGED
|
@@ -29,17 +29,37 @@ export async function update(options) {
|
|
|
29
29
|
logger.success('当前已是最新版本');
|
|
30
30
|
} else {
|
|
31
31
|
logger.info(`发现新版本: ${CURRENT_VERSION} (当前: ${rc.version})`);
|
|
32
|
-
logger.dim('运行 npx create-
|
|
32
|
+
logger.dim('运行 npx create-csch5-monorepo update 来更新');
|
|
33
33
|
}
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
const spinner = ora('
|
|
37
|
+
const spinner = ora('正在更新...').start();
|
|
38
38
|
|
|
39
39
|
try {
|
|
40
40
|
const templateDir = getTemplateDir();
|
|
41
41
|
|
|
42
|
-
//
|
|
42
|
+
// 选择性更新某个包
|
|
43
|
+
if (options.package) {
|
|
44
|
+
spinner.text = `更新 packages/${options.package}/...`;
|
|
45
|
+
const packageName = options.package;
|
|
46
|
+
const srcPath = path.join(templateDir, 'packages', packageName);
|
|
47
|
+
const destPath = path.join(cwd, 'packages', packageName);
|
|
48
|
+
|
|
49
|
+
if (!await fs.exists(srcPath)) {
|
|
50
|
+
spinner.fail(`包 ${packageName} 不存在`);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
await fs.remove(destPath);
|
|
55
|
+
await copyDir(srcPath, destPath);
|
|
56
|
+
|
|
57
|
+
spinner.succeed(`已更新 packages/${packageName}`);
|
|
58
|
+
logger.dim('请运行 pnpm install 安装可能新增的依赖');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 更新所有 packages
|
|
43
63
|
spinner.text = '更新 packages/...';
|
|
44
64
|
await copyDir(
|
|
45
65
|
path.join(templateDir, 'packages'),
|