@coze-arch/cli 0.1.4-alpha.e6e18e → 0.1.4-alpha.fb90f3
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.ps1 +1 -1
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +3 -3
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.ps1 +2 -2
- 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/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/eslint.config.mjs +11 -5
- package/lib/__templates__/nextjs/next.config.ts +10 -0
- package/lib/__templates__/nextjs/package.json +3 -6
- 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 +3 -2
- package/lib/__templates__/nextjs/scripts/dev.sh +6 -3
- package/lib/__templates__/nextjs/scripts/prepare-next-output.sh +62 -0
- 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/.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 +149 -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.ps1 +4 -1
- package/lib/__templates__/vite/scripts/build.sh +1 -1
- package/lib/__templates__/vite/scripts/dev.ps1 +7 -23
- 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.ps1 +6 -1
- 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/__templates__/nextjs/.babelrc +0 -15
- package/lib/__templates__/vite/scripts/ensure-deps.ps1 +0 -33
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.4-alpha.
|
|
2117
|
+
var version = "0.1.4-alpha.fb90f3";
|
|
2118
2118
|
var description = "coze coding devtools cli";
|
|
2119
2119
|
var license = "MIT";
|
|
2120
2120
|
var author = "fanwenjie.fe@bytedance.com";
|
|
@@ -9883,18 +9883,38 @@ const execute = async (
|
|
|
9883
9883
|
};
|
|
9884
9884
|
|
|
9885
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
|
+
|
|
9886
9905
|
/**
|
|
9887
|
-
*
|
|
9906
|
+
* 优先通过模板提供的 wrapper 准备依赖。
|
|
9888
9907
|
*/
|
|
9889
|
-
const
|
|
9890
|
-
logger.info('\
|
|
9908
|
+
const prepareDependencies = (projectPath) => {
|
|
9909
|
+
logger.info('\nPreparing dependencies with the project wrapper...');
|
|
9891
9910
|
|
|
9892
|
-
const
|
|
9911
|
+
const command = getDependencyPreparationCommand(projectPath);
|
|
9912
|
+
const result = shelljs.exec(command, {
|
|
9893
9913
|
cwd: projectPath,
|
|
9894
9914
|
silent: true,
|
|
9895
9915
|
});
|
|
9896
9916
|
|
|
9897
|
-
// verbose
|
|
9917
|
+
// verbose 模式下输出依赖准备命令的详细日志
|
|
9898
9918
|
if (result.stdout) {
|
|
9899
9919
|
logger.verbose(result.stdout);
|
|
9900
9920
|
}
|
|
@@ -9903,11 +9923,11 @@ const runPnpmInstall = (projectPath) => {
|
|
|
9903
9923
|
}
|
|
9904
9924
|
|
|
9905
9925
|
if (result.code === 0) {
|
|
9906
|
-
logger.success('Dependencies
|
|
9926
|
+
logger.success('Dependencies prepared successfully!');
|
|
9907
9927
|
} else {
|
|
9908
9928
|
// 仅在失败时输出详细信息以便排查
|
|
9909
9929
|
const errorMessage = [
|
|
9910
|
-
|
|
9930
|
+
`${command} failed with exit code ${result.code}`,
|
|
9911
9931
|
result.stderr ? `\nStderr:\n${result.stderr}` : '',
|
|
9912
9932
|
result.stdout ? `\nStdout:\n${result.stdout}` : '',
|
|
9913
9933
|
]
|
|
@@ -10132,7 +10152,7 @@ const installDependenciesStep = ctx => {
|
|
|
10132
10152
|
try {
|
|
10133
10153
|
if (!skipInstall) {
|
|
10134
10154
|
if (ctx.hasPackageJson) {
|
|
10135
|
-
|
|
10155
|
+
prepareDependencies(ctx.absoluteOutputPath);
|
|
10136
10156
|
ctx.timer.logPhase('Dependencies installation');
|
|
10137
10157
|
} else {
|
|
10138
10158
|
logger.info(
|
|
@@ -10141,7 +10161,7 @@ const installDependenciesStep = ctx => {
|
|
|
10141
10161
|
}
|
|
10142
10162
|
}
|
|
10143
10163
|
} catch (error) {
|
|
10144
|
-
//
|
|
10164
|
+
// 捕获依赖准备失败的情况
|
|
10145
10165
|
installSuccess = false;
|
|
10146
10166
|
installErrorCode = 1;
|
|
10147
10167
|
installErrorType = 'execution_failed';
|
|
@@ -10228,7 +10248,9 @@ const startDevServerStep = ctx => {
|
|
|
10228
10248
|
logger.info('\nNext steps:');
|
|
10229
10249
|
logger.info(` cd ${ctx.outputPath}`);
|
|
10230
10250
|
if (skipInstall && ctx.hasPackageJson) {
|
|
10231
|
-
logger.info(
|
|
10251
|
+
logger.info(
|
|
10252
|
+
` ${getDependencyPreparationCommand(ctx.absoluteOutputPath)}`,
|
|
10253
|
+
);
|
|
10232
10254
|
}
|
|
10233
10255
|
if (skipGit) {
|
|
10234
10256
|
logger.info(' git init');
|
|
@@ -10340,7 +10362,7 @@ const registerCommand$1 = program => {
|
|
|
10340
10362
|
.argument('[directory]', 'Output directory for the project')
|
|
10341
10363
|
.requiredOption('-t, --template <name>', 'Template name')
|
|
10342
10364
|
.option('-o, --output <path>', 'Output directory', process.cwd())
|
|
10343
|
-
.option('--skip-install', 'Skip automatic
|
|
10365
|
+
.option('--skip-install', 'Skip automatic dependency preparation', false)
|
|
10344
10366
|
.option('--skip-git', 'Skip automatic git initialization', false)
|
|
10345
10367
|
.option(
|
|
10346
10368
|
'--skip-commit',
|
package/package.json
CHANGED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
$ErrorActionPreference = "Stop"
|
|
2
|
-
|
|
3
|
-
$workspace = if ($env:COZE_WORKSPACE_PATH) { $env:COZE_WORKSPACE_PATH } else { (Get-Location).Path }
|
|
4
|
-
Set-Location $workspace
|
|
5
|
-
|
|
6
|
-
$lockfile = Join-Path $workspace "pnpm-lock.yaml"
|
|
7
|
-
$modulesDirectory = Join-Path $workspace "node_modules"
|
|
8
|
-
$modulesManifest = Join-Path $modulesDirectory ".modules.yaml"
|
|
9
|
-
$lockHashFile = Join-Path $modulesDirectory ".coze-lockfile-sha256"
|
|
10
|
-
|
|
11
|
-
if (-not (Test-Path $lockfile)) {
|
|
12
|
-
throw "pnpm-lock.yaml is required to install dependencies."
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
$lockHash = (Get-FileHash -LiteralPath $lockfile -Algorithm SHA256).Hash
|
|
16
|
-
$cachedLockHash = if (Test-Path $lockHashFile) {
|
|
17
|
-
(Get-Content -LiteralPath $lockHashFile -Raw).Trim()
|
|
18
|
-
} else {
|
|
19
|
-
""
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if ((Test-Path $modulesManifest) -and $cachedLockHash -eq $lockHash) {
|
|
23
|
-
Write-Host "Dependencies already match pnpm-lock.yaml; skipping install."
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
Write-Host "Installing dependencies..."
|
|
28
|
-
& pnpm install --frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
29
|
-
if ($LASTEXITCODE -ne 0) {
|
|
30
|
-
throw "pnpm install failed with exit code $LASTEXITCODE."
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
Set-Content -LiteralPath $lockHashFile -Value $lockHash -NoNewline
|