@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.
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +7 -3
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +2 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +3 -3
- package/lib/__templates__/nextjs/next.config.ts +1 -0
- package/lib/__templates__/nextjs/package.json +2 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +15 -15
- package/lib/__templates__/nextjs/scripts/build.ps1 +1 -1
- package/lib/__templates__/nextjs/scripts/build.sh +2 -2
- package/lib/__templates__/nextjs/scripts/dev.sh +2 -0
- package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/nextjs/scripts/prepare.sh +1 -4
- package/lib/__templates__/nextjs/src/server.ts +1 -1
- package/lib/__templates__/nextjs/template.config.js +0 -59
- package/lib/__templates__/nuxt-vue/scripts/build.sh +1 -1
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +2 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +1 -4
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +3 -2
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +3 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +3 -1
- package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/vite/scripts/build.sh +1 -1
- package/lib/__templates__/vite/scripts/dev.sh +2 -0
- package/lib/__templates__/vite/scripts/prepare-node-modules.sh +142 -0
- package/lib/__templates__/vite/scripts/prepare.sh +1 -4
- package/lib/__templates__/vite/template.config.js +0 -59
- package/lib/cli.js +34 -12
- 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.
|
|
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
|
-
*
|
|
9905
|
+
* 优先通过模板提供的 wrapper 准备依赖。
|
|
9887
9906
|
*/
|
|
9888
|
-
const
|
|
9889
|
-
logger.info('\
|
|
9907
|
+
const prepareDependencies = (projectPath) => {
|
|
9908
|
+
logger.info('\nPreparing dependencies with the project wrapper...');
|
|
9890
9909
|
|
|
9891
|
-
const
|
|
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
|
|
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
|
|
9925
|
+
logger.success('Dependencies prepared successfully!');
|
|
9906
9926
|
} else {
|
|
9907
9927
|
// 仅在失败时输出详细信息以便排查
|
|
9908
9928
|
const errorMessage = [
|
|
9909
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
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(
|
|
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
|
|
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',
|