@coze-arch/cli 0.1.3-alpha.8d71d5 → 0.1.3-alpha.b37ec0

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.
Files changed (29) hide show
  1. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +7 -3
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +2 -0
  3. package/lib/__templates__/expo/.cozeproj/scripts/prepare-node-modules.sh +142 -0
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +3 -3
  5. package/lib/__templates__/nextjs/next.config.ts +1 -0
  6. package/lib/__templates__/nextjs/package.json +2 -2
  7. package/lib/__templates__/nextjs/pnpm-lock.yaml +15 -15
  8. package/lib/__templates__/nextjs/scripts/build.ps1 +1 -1
  9. package/lib/__templates__/nextjs/scripts/build.sh +2 -2
  10. package/lib/__templates__/nextjs/scripts/dev.sh +2 -0
  11. package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +142 -0
  12. package/lib/__templates__/nextjs/scripts/prepare.sh +1 -4
  13. package/lib/__templates__/nextjs/src/server.ts +1 -1
  14. package/lib/__templates__/nextjs/template.config.js +0 -59
  15. package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
  16. package/lib/__templates__/nuxt-vue/scripts/dev.sh +2 -0
  17. package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +142 -0
  18. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +1 -4
  19. package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +3 -2
  20. package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +3 -0
  21. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +3 -1
  22. package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +142 -0
  23. package/lib/__templates__/vite/scripts/build.sh +1 -1
  24. package/lib/__templates__/vite/scripts/dev.sh +2 -0
  25. package/lib/__templates__/vite/scripts/prepare-node-modules.sh +142 -0
  26. package/lib/__templates__/vite/scripts/prepare.sh +1 -4
  27. package/lib/__templates__/vite/template.config.js +0 -59
  28. package/lib/cli.js +34 -12
  29. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -2114,7 +2114,7 @@ const EventBuilder = {
2114
2114
  };
2115
2115
 
2116
2116
  var name = "@coze-arch/cli";
2117
- var version = "0.1.3-alpha.8d71d5";
2117
+ var version = "0.1.3-alpha.b37ec0";
2118
2118
  var description = "coze coding devtools cli";
2119
2119
  var license = "MIT";
2120
2120
  var author = "fanwenjie.fe@bytedance.com";
@@ -9882,18 +9882,38 @@ const execute = async (
9882
9882
  };
9883
9883
 
9884
9884
  function _nullishCoalesce$2(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
9885
+ const getDependencyPreparationCommand = (projectPath) => {
9886
+ if (fs.existsSync(path.join(projectPath, 'scripts', 'prepare.sh'))) {
9887
+ return 'bash ./scripts/prepare.sh';
9888
+ }
9889
+ if (
9890
+ fs.existsSync(
9891
+ path.join(
9892
+ projectPath,
9893
+ '.cozeproj',
9894
+ 'scripts',
9895
+ 'prepare-node-modules.sh',
9896
+ ),
9897
+ )
9898
+ ) {
9899
+ return 'bash ./.cozeproj/scripts/prepare-node-modules.sh';
9900
+ }
9901
+ return 'pnpm install';
9902
+ };
9903
+
9885
9904
  /**
9886
- * 运行 pnpm install
9905
+ * 优先通过模板提供的 wrapper 准备依赖。
9887
9906
  */
9888
- const runPnpmInstall = (projectPath) => {
9889
- logger.info('\nInstalling dependencies with pnpm...');
9907
+ const prepareDependencies = (projectPath) => {
9908
+ logger.info('\nPreparing dependencies with the project wrapper...');
9890
9909
 
9891
- const result = shelljs.exec('pnpm install', {
9910
+ const command = getDependencyPreparationCommand(projectPath);
9911
+ const result = shelljs.exec(command, {
9892
9912
  cwd: projectPath,
9893
9913
  silent: true,
9894
9914
  });
9895
9915
 
9896
- // verbose 模式下输出 pnpm install 的详细日志
9916
+ // verbose 模式下输出依赖准备命令的详细日志
9897
9917
  if (result.stdout) {
9898
9918
  logger.verbose(result.stdout);
9899
9919
  }
@@ -9902,11 +9922,11 @@ const runPnpmInstall = (projectPath) => {
9902
9922
  }
9903
9923
 
9904
9924
  if (result.code === 0) {
9905
- logger.success('Dependencies installed successfully!');
9925
+ logger.success('Dependencies prepared successfully!');
9906
9926
  } else {
9907
9927
  // 仅在失败时输出详细信息以便排查
9908
9928
  const errorMessage = [
9909
- `pnpm install failed with exit code ${result.code}`,
9929
+ `${command} failed with exit code ${result.code}`,
9910
9930
  result.stderr ? `\nStderr:\n${result.stderr}` : '',
9911
9931
  result.stdout ? `\nStdout:\n${result.stdout}` : '',
9912
9932
  ]
@@ -10131,7 +10151,7 @@ const installDependenciesStep = ctx => {
10131
10151
  try {
10132
10152
  if (!skipInstall) {
10133
10153
  if (ctx.hasPackageJson) {
10134
- runPnpmInstall(ctx.absoluteOutputPath);
10154
+ prepareDependencies(ctx.absoluteOutputPath);
10135
10155
  ctx.timer.logPhase('Dependencies installation');
10136
10156
  } else {
10137
10157
  logger.info(
@@ -10140,7 +10160,7 @@ const installDependenciesStep = ctx => {
10140
10160
  }
10141
10161
  }
10142
10162
  } catch (error) {
10143
- // 捕获 pnpm install 失败的情况
10163
+ // 捕获依赖准备失败的情况
10144
10164
  installSuccess = false;
10145
10165
  installErrorCode = 1;
10146
10166
  installErrorType = 'execution_failed';
@@ -10227,7 +10247,9 @@ const startDevServerStep = ctx => {
10227
10247
  logger.info('\nNext steps:');
10228
10248
  logger.info(` cd ${ctx.outputPath}`);
10229
10249
  if (skipInstall && ctx.hasPackageJson) {
10230
- logger.info(' pnpm install');
10250
+ logger.info(
10251
+ ` ${getDependencyPreparationCommand(ctx.absoluteOutputPath)}`,
10252
+ );
10231
10253
  }
10232
10254
  if (skipGit) {
10233
10255
  logger.info(' git init');
@@ -10339,7 +10361,7 @@ const registerCommand$1 = program => {
10339
10361
  .argument('[directory]', 'Output directory for the project')
10340
10362
  .requiredOption('-t, --template <name>', 'Template name')
10341
10363
  .option('-o, --output <path>', 'Output directory', process.cwd())
10342
- .option('--skip-install', 'Skip automatic pnpm install', false)
10364
+ .option('--skip-install', 'Skip automatic dependency preparation', false)
10343
10365
  .option('--skip-git', 'Skip automatic git initialization', false)
10344
10366
  .option(
10345
10367
  '--skip-commit',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/cli",
3
- "version": "0.1.3-alpha.8d71d5",
3
+ "version": "0.1.3-alpha.b37ec0",
4
4
  "private": false,
5
5
  "description": "coze coding devtools cli",
6
6
  "license": "MIT",