@coze-arch/cli 0.1.3 → 0.1.4-alpha.170425
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/.coze +3 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.ps1 +10 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +3 -3
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.ps1 +74 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +2 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prepare-node-modules.sh +149 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +3 -3
- package/lib/__templates__/expo/.cozeproj/scripts/validate.ps1 +7 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +65 -25
- package/lib/__templates__/expo/client/heroui/components/toast/toast.tsx +6 -2
- package/lib/__templates__/expo/client/heroui/helpers/internal/hooks/use-controllable-state.ts +1 -1
- package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
- package/lib/__templates__/expo/server/package.json +1 -1
- package/lib/__templates__/nextjs/next.config.ts +1 -0
- package/lib/__templates__/nextjs/package.json +2 -5
- package/lib/__templates__/nextjs/pnpm-lock.yaml +19 -950
- 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 +4 -3
- package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +149 -0
- package/lib/__templates__/nextjs/scripts/prepare.sh +1 -4
- package/lib/__templates__/nextjs/src/app/layout.tsx +0 -4
- package/lib/__templates__/nextjs/src/server.ts +1 -1
- package/lib/__templates__/nextjs/template.config.js +0 -59
- package/lib/__templates__/nuxt-vue/package.json +1 -1
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +5 -5
- 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 +149 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +1 -4
- package/lib/__templates__/pi-agent/package.json +1 -1
- package/lib/__templates__/pi-agent/pnpm-lock.yaml +5 -5
- package/lib/__templates__/taro/.coze +4 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +3 -2
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.ps1 +3 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +3 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.ps1 +62 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +3 -1
- package/lib/__templates__/taro/.cozeproj/scripts/pack.ps1 +7 -0
- package/lib/__templates__/taro/.cozeproj/scripts/prepare-node-modules.sh +149 -0
- package/lib/__templates__/taro/.cozeproj/scripts/validate.ps1 +7 -0
- package/lib/__templates__/taro/pnpm-lock.yaml +5 -5
- package/lib/__templates__/taro/server/package.json +1 -1
- package/lib/__templates__/vite/package.json +1 -1
- package/lib/__templates__/vite/pnpm-lock.yaml +5 -5
- 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 +149 -0
- package/lib/__templates__/vite/scripts/prepare.sh +1 -4
- package/lib/__templates__/vite/template.config.js +0 -59
- package/lib/cli.js +38 -13
- package/lib/deploy/package-project.js +4 -1
- package/package.json +1 -1
- package/lib/__templates__/nextjs/.babelrc +0 -15
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.
|
|
2117
|
+
var version = "0.1.4-alpha.170425";
|
|
2118
2118
|
var description = "coze coding devtools cli";
|
|
2119
2119
|
var license = "MIT";
|
|
2120
2120
|
var author = "fanwenjie.fe@bytedance.com";
|
|
@@ -9179,6 +9179,7 @@ const shouldRenderFile = (filePath) => {
|
|
|
9179
9179
|
'.prettierrc',
|
|
9180
9180
|
'.babelrc',
|
|
9181
9181
|
'.sh',
|
|
9182
|
+
'.ps1',
|
|
9182
9183
|
]);
|
|
9183
9184
|
|
|
9184
9185
|
const ext = path.extname(filePath).toLowerCase();
|
|
@@ -9882,18 +9883,38 @@ const execute = async (
|
|
|
9882
9883
|
};
|
|
9883
9884
|
|
|
9884
9885
|
function _nullishCoalesce$2(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
9886
|
+
const getDependencyPreparationCommand = (projectPath) => {
|
|
9887
|
+
if (fs.existsSync(path.join(projectPath, 'scripts', 'prepare.sh'))) {
|
|
9888
|
+
return 'bash ./scripts/prepare.sh';
|
|
9889
|
+
}
|
|
9890
|
+
if (
|
|
9891
|
+
fs.existsSync(
|
|
9892
|
+
path.join(
|
|
9893
|
+
projectPath,
|
|
9894
|
+
'.cozeproj',
|
|
9895
|
+
'scripts',
|
|
9896
|
+
'prepare-node-modules.sh',
|
|
9897
|
+
),
|
|
9898
|
+
)
|
|
9899
|
+
) {
|
|
9900
|
+
return 'bash ./.cozeproj/scripts/prepare-node-modules.sh';
|
|
9901
|
+
}
|
|
9902
|
+
return 'pnpm install';
|
|
9903
|
+
};
|
|
9904
|
+
|
|
9885
9905
|
/**
|
|
9886
|
-
*
|
|
9906
|
+
* 优先通过模板提供的 wrapper 准备依赖。
|
|
9887
9907
|
*/
|
|
9888
|
-
const
|
|
9889
|
-
logger.info('\
|
|
9908
|
+
const prepareDependencies = (projectPath) => {
|
|
9909
|
+
logger.info('\nPreparing dependencies with the project wrapper...');
|
|
9890
9910
|
|
|
9891
|
-
const
|
|
9911
|
+
const command = getDependencyPreparationCommand(projectPath);
|
|
9912
|
+
const result = shelljs.exec(command, {
|
|
9892
9913
|
cwd: projectPath,
|
|
9893
9914
|
silent: true,
|
|
9894
9915
|
});
|
|
9895
9916
|
|
|
9896
|
-
// verbose
|
|
9917
|
+
// verbose 模式下输出依赖准备命令的详细日志
|
|
9897
9918
|
if (result.stdout) {
|
|
9898
9919
|
logger.verbose(result.stdout);
|
|
9899
9920
|
}
|
|
@@ -9902,11 +9923,11 @@ const runPnpmInstall = (projectPath) => {
|
|
|
9902
9923
|
}
|
|
9903
9924
|
|
|
9904
9925
|
if (result.code === 0) {
|
|
9905
|
-
logger.success('Dependencies
|
|
9926
|
+
logger.success('Dependencies prepared successfully!');
|
|
9906
9927
|
} else {
|
|
9907
9928
|
// 仅在失败时输出详细信息以便排查
|
|
9908
9929
|
const errorMessage = [
|
|
9909
|
-
|
|
9930
|
+
`${command} failed with exit code ${result.code}`,
|
|
9910
9931
|
result.stderr ? `\nStderr:\n${result.stderr}` : '',
|
|
9911
9932
|
result.stdout ? `\nStdout:\n${result.stdout}` : '',
|
|
9912
9933
|
]
|
|
@@ -10131,7 +10152,7 @@ const installDependenciesStep = ctx => {
|
|
|
10131
10152
|
try {
|
|
10132
10153
|
if (!skipInstall) {
|
|
10133
10154
|
if (ctx.hasPackageJson) {
|
|
10134
|
-
|
|
10155
|
+
prepareDependencies(ctx.absoluteOutputPath);
|
|
10135
10156
|
ctx.timer.logPhase('Dependencies installation');
|
|
10136
10157
|
} else {
|
|
10137
10158
|
logger.info(
|
|
@@ -10140,7 +10161,7 @@ const installDependenciesStep = ctx => {
|
|
|
10140
10161
|
}
|
|
10141
10162
|
}
|
|
10142
10163
|
} catch (error) {
|
|
10143
|
-
//
|
|
10164
|
+
// 捕获依赖准备失败的情况
|
|
10144
10165
|
installSuccess = false;
|
|
10145
10166
|
installErrorCode = 1;
|
|
10146
10167
|
installErrorType = 'execution_failed';
|
|
@@ -10227,7 +10248,9 @@ const startDevServerStep = ctx => {
|
|
|
10227
10248
|
logger.info('\nNext steps:');
|
|
10228
10249
|
logger.info(` cd ${ctx.outputPath}`);
|
|
10229
10250
|
if (skipInstall && ctx.hasPackageJson) {
|
|
10230
|
-
logger.info(
|
|
10251
|
+
logger.info(
|
|
10252
|
+
` ${getDependencyPreparationCommand(ctx.absoluteOutputPath)}`,
|
|
10253
|
+
);
|
|
10231
10254
|
}
|
|
10232
10255
|
if (skipGit) {
|
|
10233
10256
|
logger.info(' git init');
|
|
@@ -10339,7 +10362,7 @@ const registerCommand$1 = program => {
|
|
|
10339
10362
|
.argument('[directory]', 'Output directory for the project')
|
|
10340
10363
|
.requiredOption('-t, --template <name>', 'Template name')
|
|
10341
10364
|
.option('-o, --output <path>', 'Output directory', process.cwd())
|
|
10342
|
-
.option('--skip-install', 'Skip automatic
|
|
10365
|
+
.option('--skip-install', 'Skip automatic dependency preparation', false)
|
|
10343
10366
|
.option('--skip-git', 'Skip automatic git initialization', false)
|
|
10344
10367
|
.option(
|
|
10345
10368
|
'--skip-commit',
|
|
@@ -12265,7 +12288,9 @@ const EXCLUDED_PARTS = new Set([
|
|
|
12265
12288
|
'.env',
|
|
12266
12289
|
'node_modules',
|
|
12267
12290
|
]);
|
|
12268
|
-
|
|
12291
|
+
// Keep archives reproducible while remaining compatible with downstream ZIP
|
|
12292
|
+
// packaging, whose timestamp range starts in 1980.
|
|
12293
|
+
const REPRODUCIBLE_ARCHIVE_MTIME = new Date('2000-01-01T00:00:00.000Z');
|
|
12269
12294
|
|
|
12270
12295
|
const validateBuildOutput = async (
|
|
12271
12296
|
sourceRoot,
|
|
@@ -35,7 +35,10 @@ const LOCAL_METADATA_FILES = new Set([
|
|
|
35
35
|
'.host.json',
|
|
36
36
|
]);
|
|
37
37
|
const UPLOAD_SESSION_TEMP_PREFIX = '.coze-deploy-upload-';
|
|
38
|
-
|
|
38
|
+
// Keep archives reproducible without producing timestamps that ZIP cannot
|
|
39
|
+
// represent when the Deploy service repackages the source. Using 2000 also
|
|
40
|
+
// avoids the 1980 lower-bound edge in tools that apply a local timezone.
|
|
41
|
+
const REPRODUCIBLE_ARCHIVE_MTIME = new Date('2000-01-01T00:00:00.000Z');
|
|
39
42
|
const PROJECT_METADATA_FILE_MODE = 0o644;
|
|
40
43
|
|
|
41
44
|
const parseArguments = argv => {
|
package/package.json
CHANGED