@coze-arch/cli 0.1.8-alpha.e237ba → 0.1.9-alpha.01bd9e
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_run.ps1 +2 -2
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +1 -1
- package/lib/__templates__/expo/client/package.json +1 -1
- package/lib/__templates__/nextjs/eslint.config.mjs +1 -1
- package/lib/__templates__/nextjs/next.config.ts +0 -9
- package/lib/__templates__/nextjs/scripts/build.ps1 +1 -1
- package/lib/__templates__/nextjs/scripts/build.sh +1 -1
- package/lib/__templates__/nextjs/scripts/dev.ps1 +2 -2
- package/lib/__templates__/nextjs/scripts/dev.sh +4 -25
- package/lib/__templates__/nextjs/scripts/prepare.sh +1 -1
- package/lib/__templates__/nextjs/src/server.ts +1 -1
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +1 -1
- package/lib/__templates__/taro/.coze +2 -2
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +6 -1
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +10 -1
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +56 -4
- package/lib/__templates__/taro/.cozeproj/scripts/local-workspace.cjs +351 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +16 -6
- package/lib/__templates__/taro/.cozeproj/scripts/taro-build.cjs +66 -0
- package/lib/__templates__/taro/.cozeproj/scripts/validate.sh +3 -0
- package/lib/__templates__/taro/package.json +5 -5
- package/lib/__templates__/vite/scripts/prepare.sh +1 -1
- package/lib/cli.js +19 -7
- package/package.json +1 -1
- package/lib/__templates__/nextjs/scripts/prepare-node-modules.sh +0 -380
- package/lib/__templates__/nuxt-vue/scripts/prepare-node-modules.sh +0 -380
- package/lib/__templates__/vite/scripts/prepare-node-modules.sh +0 -380
|
@@ -60,14 +60,14 @@ Write-Host "Starting Expo on port $expoPort..."
|
|
|
60
60
|
$expoEnvironment = @{}
|
|
61
61
|
$sharedEnvironment.GetEnumerator() | ForEach-Object { $expoEnvironment[$_.Key] = $_.Value }
|
|
62
62
|
$expoEnvironment.EXPO_NO_DEPENDENCY_VALIDATION = "1"
|
|
63
|
-
$expo = Start-LoggedProcess (Join-Path $workspace "client") $clientLog @("exec", "expo", "start", "--
|
|
63
|
+
$expo = Start-LoggedProcess (Join-Path $workspace "client") $clientLog @("exec", "expo", "start", "--port", "$expoPort") $expoEnvironment
|
|
64
64
|
|
|
65
65
|
Start-Sleep -Seconds 8
|
|
66
66
|
if ((Test-Path $clientLog) -and (Select-String -Path $clientLog -Pattern "TypeError: fetch failed" -Quiet)) {
|
|
67
67
|
Write-Host "Expo startup detected a network error; retrying in offline mode."
|
|
68
68
|
Stop-ProcessTree $expo.Id
|
|
69
69
|
$expoEnvironment.EXPO_OFFLINE = "1"
|
|
70
|
-
$expo = Start-LoggedProcess (Join-Path $workspace "client") $clientLog @("exec", "expo", "start", "--
|
|
70
|
+
$expo = Start-LoggedProcess (Join-Path $workspace "client") $clientLog @("exec", "expo", "start", "--port", "$expoPort") $expoEnvironment
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
Write-Host "Services started. Server PID: $($server.Id), Expo PID: $($expo.Id)"
|
|
@@ -215,7 +215,7 @@ start_expo() {
|
|
|
215
215
|
"$ROOT_DIR/client" \
|
|
216
216
|
"$LOG_CLIENT_FILE" \
|
|
217
217
|
/usr/bin/env "${expo_env[@]}" \
|
|
218
|
-
"$PNPM_BIN" exec expo start --
|
|
218
|
+
"$PNPM_BIN" exec expo start --port "$EXPO_PORT")"
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
detect_expo_fetch_failed() {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"postinstall": "npm run install-missing",
|
|
9
9
|
"install-missing": "node ./scripts/install-missing-deps.js",
|
|
10
10
|
"lint": "tsc --noEmit; eslint ./ -f ./scripts/formatter.mjs --quiet",
|
|
11
|
-
"start": "expo start --web
|
|
11
|
+
"start": "expo start --web",
|
|
12
12
|
"test": "jest --watchAll"
|
|
13
13
|
},
|
|
14
14
|
"jest": {
|
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
import type { NextConfig } from 'next';
|
|
2
|
-
import path from 'path';
|
|
3
2
|
|
|
4
3
|
const nextConfig: NextConfig = {
|
|
5
4
|
// outputFileTracingRoot: path.resolve(__dirname, '../../'), // Uncomment and add 'import path from "path"' if needed
|
|
6
5
|
/* config options here */
|
|
7
6
|
serverExternalPackages: ['coze-coding-dev-sdk'],
|
|
8
|
-
webpack: (config, { dev }) => {
|
|
9
|
-
if (dev && config.cache && config.cache.type === 'filesystem') {
|
|
10
|
-
config.cache.cacheDirectory = path.resolve(
|
|
11
|
-
'node_modules/.cache/next-webpack',
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
return config;
|
|
15
|
-
},
|
|
16
7
|
allowedDevOrigins: ['*.dev.coze.site'],
|
|
17
8
|
images: {
|
|
18
9
|
remotePatterns: [
|
|
@@ -8,7 +8,7 @@ Write-Host "Installing dependencies..."
|
|
|
8
8
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
9
9
|
|
|
10
10
|
Write-Host "Building the Next.js project..."
|
|
11
|
-
& pnpm next build
|
|
11
|
+
& pnpm next build
|
|
12
12
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
13
13
|
|
|
14
14
|
Write-Host "Bundling server with tsup..."
|
|
@@ -9,7 +9,7 @@ echo "Installing dependencies..."
|
|
|
9
9
|
pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
10
10
|
|
|
11
11
|
echo "Building the Next.js project..."
|
|
12
|
-
pnpm next build
|
|
12
|
+
pnpm next build
|
|
13
13
|
|
|
14
14
|
echo "Bundling server with tsup..."
|
|
15
15
|
pnpm tsup src/server.ts --format cjs --platform node --target node20 --outDir dist --no-splitting --no-minify
|
|
@@ -28,7 +28,7 @@ Stop-ListeningProcess $port
|
|
|
28
28
|
|
|
29
29
|
<% if (process.env.NODE_ENV === 'test') { %>
|
|
30
30
|
$env:PORT = "$port"
|
|
31
|
-
& pnpm next dev --
|
|
31
|
+
& pnpm next dev --hostname 0.0.0.0 --port $port
|
|
32
32
|
exit $LASTEXITCODE
|
|
33
33
|
<% } else { %>
|
|
34
34
|
$logDirectory = if ($env:COZE_LOG_DIR) { $env:COZE_LOG_DIR } else { Join-Path $workspace "logs" }
|
|
@@ -45,7 +45,7 @@ if (Test-Path $pidFile) {
|
|
|
45
45
|
$previousPort = $env:PORT
|
|
46
46
|
$env:PORT = "$port"
|
|
47
47
|
try {
|
|
48
|
-
$process = Start-Process -FilePath $env:ComSpec -ArgumentList @("/d", "/s", "/c", "pnpm next dev --
|
|
48
|
+
$process = Start-Process -FilePath $env:ComSpec -ArgumentList @("/d", "/s", "/c", "pnpm next dev --hostname 0.0.0.0 --port $port") -WorkingDirectory $workspace -RedirectStandardOutput $logFile -RedirectStandardError $errorLogFile -PassThru
|
|
49
49
|
} finally {
|
|
50
50
|
if ($null -eq $previousPort) { Remove-Item Env:PORT -ErrorAction SilentlyContinue } else { $env:PORT = $previousPort }
|
|
51
51
|
}
|
|
@@ -58,37 +58,17 @@ kill_port_if_listening() {
|
|
|
58
58
|
echo "Port ${DEPLOY_RUN_PORT} cleared."
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
# Next 的路由清单由 watchpack 每次启动重新扫 src 下的 app/pages 目录现算,而 watchpack
|
|
62
|
-
# 不会进入软链目录,软链子树里的 page/route 会被静默跳过:既不注册路由,也不打任何日志,
|
|
63
|
-
# 表现为该路由一直 404 而 .next 里没有它的产物。这里只做提示,不改动源码。
|
|
64
|
-
warn_source_symlinks() {
|
|
65
|
-
local source_dir="${COZE_WORKSPACE_PATH}/src"
|
|
66
|
-
local links link
|
|
67
|
-
if [[ ! -e "${source_dir}" ]]; then
|
|
68
|
-
return
|
|
69
|
-
fi
|
|
70
|
-
links=$(find "${source_dir}" -type l 2>/dev/null || true)
|
|
71
|
-
if [[ -z "${links}" ]]; then
|
|
72
|
-
return
|
|
73
|
-
fi
|
|
74
|
-
echo "Warning: 以下路径是软链,Next 不会进入其中,里面的 page/route 不会被编译:" >&2
|
|
75
|
-
while IFS= read -r link; do
|
|
76
|
-
echo " ${link}" >&2
|
|
77
|
-
done <<< "${links}"
|
|
78
|
-
}
|
|
79
|
-
|
|
80
61
|
<% if (process.env.NODE_ENV === 'test') { %>
|
|
81
62
|
echo "Clearing port ${DEPLOY_RUN_PORT} before start."
|
|
82
63
|
kill_port_if_listening
|
|
83
64
|
if [[ "${COZE_WEB_LOCAL_MIRROR:-}" != "1" ]]; then
|
|
84
|
-
|
|
65
|
+
pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
85
66
|
fi
|
|
86
|
-
warn_source_symlinks
|
|
87
67
|
echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for dev..."
|
|
88
68
|
|
|
89
69
|
# 测试环境保持服务为前台进程,便于 e2e 收集输出并停止进程。
|
|
90
70
|
# 开发环境直接使用 Next 的 dev CLI,避免云盘文件事件在 custom server 链路中丢失。
|
|
91
|
-
exec node "${SCRIPT_DIR}/local-workspace.cjs" watch pnpm next dev --
|
|
71
|
+
exec node "${SCRIPT_DIR}/local-workspace.cjs" watch pnpm next dev --hostname 0.0.0.0 --port "${DEPLOY_RUN_PORT}"
|
|
92
72
|
<% } else { %>
|
|
93
73
|
LOG_DIR="${COZE_LOG_DIR:-${COZE_WORKSPACE_PATH}/logs}"
|
|
94
74
|
LOG_FILE="${LOG_DIR}/app.log"
|
|
@@ -276,9 +256,8 @@ fi
|
|
|
276
256
|
echo "Clearing port ${DEPLOY_RUN_PORT} before start."
|
|
277
257
|
kill_port_if_listening
|
|
278
258
|
if [[ "${COZE_WEB_LOCAL_MIRROR:-}" != "1" ]]; then
|
|
279
|
-
|
|
259
|
+
pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
280
260
|
fi
|
|
281
|
-
warn_source_symlinks
|
|
282
261
|
echo "Starting HTTP service on port ${DEPLOY_RUN_PORT} for dev..."
|
|
283
262
|
|
|
284
263
|
mkdir -p "${LOG_DIR}"
|
|
@@ -286,7 +265,7 @@ mkdir -p "${LOG_DIR}"
|
|
|
286
265
|
|
|
287
266
|
export PORT="${DEPLOY_RUN_PORT}"
|
|
288
267
|
server_pid="$(spawn_detached "${COZE_WORKSPACE_PATH}" "${LOG_FILE}" \
|
|
289
|
-
"$(command -v node)" "${SCRIPT_DIR}/local-workspace.cjs" watch "$(command -v pnpm)" next dev --
|
|
268
|
+
"$(command -v node)" "${SCRIPT_DIR}/local-workspace.cjs" watch "$(command -v pnpm)" next dev --hostname 0.0.0.0 --port "${DEPLOY_RUN_PORT}")"
|
|
290
269
|
if [[ -z "${server_pid}" ]]; then
|
|
291
270
|
echo "Dev server failed to start: 未获取到后台进程 PID。" >&2
|
|
292
271
|
dump_log
|
|
@@ -13,5 +13,5 @@ cd "${COZE_WORKSPACE_PATH}"
|
|
|
13
13
|
|
|
14
14
|
echo "Installing dependencies..."
|
|
15
15
|
if [[ "${COZE_WEB_LOCAL_MIRROR:-}" != "1" ]]; then
|
|
16
|
-
|
|
16
|
+
pnpm install --prefer-frozen-lockfile --prefer-offline --loglevel debug --reporter=append-only
|
|
17
17
|
fi
|
|
@@ -7,7 +7,7 @@ const hostname = process.env.HOSTNAME || 'localhost';
|
|
|
7
7
|
const port = parseInt(process.env.PORT || '<%= port %>', 10);
|
|
8
8
|
|
|
9
9
|
// Create Next.js app
|
|
10
|
-
const app = next({ dev, hostname, port
|
|
10
|
+
const app = next({ dev, hostname, port });
|
|
11
11
|
const handle = app.getRequestHandler();
|
|
12
12
|
|
|
13
13
|
app.prepare().then(() => {
|
|
@@ -13,7 +13,7 @@ cd "${COZE_WORKSPACE_PATH}"
|
|
|
13
13
|
|
|
14
14
|
echo "Installing dependencies..."
|
|
15
15
|
if [[ "${COZE_WEB_LOCAL_MIRROR:-}" != "1" ]]; then
|
|
16
|
-
|
|
16
|
+
pnpm install --prefer-frozen-lockfile --prefer-offline
|
|
17
17
|
fi
|
|
18
18
|
|
|
19
19
|
echo "Preparing Nuxt project..."
|
|
@@ -8,7 +8,7 @@ build = ["bash", ".cozeproj/scripts/dev_build.sh"]
|
|
|
8
8
|
build_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", ".cozeproj/scripts/dev_build.ps1"]
|
|
9
9
|
run = ["bash", ".cozeproj/scripts/dev_run.sh"]
|
|
10
10
|
run_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", ".cozeproj/scripts/dev_run.ps1"]
|
|
11
|
-
deps = ["git"] # -> apt install git
|
|
11
|
+
deps = ["git", "rsync"] # -> apt install git rsync
|
|
12
12
|
pack = ["bash", ".cozeproj/scripts/pack.sh"]
|
|
13
13
|
pack_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", ".cozeproj/scripts/pack.ps1"]
|
|
14
14
|
validate = ["bash", ".cozeproj/scripts/validate.sh"]
|
|
@@ -17,4 +17,4 @@ validate_win = ["powershell.exe", "-NoProfile", "-ExecutionPolicy", "Bypass", "-
|
|
|
17
17
|
[deploy]
|
|
18
18
|
build = ["bash", ".cozeproj/scripts/deploy_build.sh"]
|
|
19
19
|
run = ["bash", ".cozeproj/scripts/deploy_run.sh"]
|
|
20
|
-
deps = ["git"] # -> apt install git
|
|
20
|
+
deps = ["git", "rsync"] # -> apt install git rsync
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
set -Eeuo pipefail
|
|
3
3
|
|
|
4
4
|
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
5
|
+
if [[ "${COZE_TARO_LOCAL_ACTIVE:-}" != "${ROOT_DIR}" ]]; then
|
|
6
|
+
exec node "$ROOT_DIR/.cozeproj/scripts/local-workspace.cjs" build "$@"
|
|
7
|
+
fi
|
|
5
8
|
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-${ROOT_DIR}}"
|
|
6
9
|
export COZE_WORKSPACE_PATH
|
|
7
10
|
|
|
@@ -15,7 +18,9 @@ else
|
|
|
15
18
|
fi
|
|
16
19
|
echo "Installing dependencies..."
|
|
17
20
|
# 安装所有依赖(包含 Taro 核心和 React)
|
|
18
|
-
|
|
21
|
+
if [[ "${COZE_TARO_LOCAL_MIRROR:-}" != "1" ]]; then
|
|
22
|
+
bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline
|
|
23
|
+
fi
|
|
19
24
|
|
|
20
25
|
echo "Building the Taro project..."
|
|
21
26
|
pnpm build
|
|
@@ -2,4 +2,13 @@
|
|
|
2
2
|
set -Eeuo pipefail
|
|
3
3
|
|
|
4
4
|
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
5
|
-
|
|
5
|
+
if [[ "${COZE_TARO_LOCAL_ACTIVE:-}" != "${ROOT_DIR}" ]]; then
|
|
6
|
+
exec node "$ROOT_DIR/.cozeproj/scripts/local-workspace.cjs" prepare "$@"
|
|
7
|
+
fi
|
|
8
|
+
COZE_WORKSPACE_PATH="${ROOT_DIR}"
|
|
9
|
+
export COZE_WORKSPACE_PATH
|
|
10
|
+
|
|
11
|
+
cd "${COZE_WORKSPACE_PATH}"
|
|
12
|
+
if [[ "${COZE_TARO_LOCAL_MIRROR:-}" != "1" ]]; then
|
|
13
|
+
bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline
|
|
14
|
+
fi
|
|
@@ -3,6 +3,9 @@ echo "⚙️ dev_run.sh 开始运行"
|
|
|
3
3
|
set -Eeuo pipefail
|
|
4
4
|
|
|
5
5
|
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
6
|
+
if [[ "${COZE_TARO_LOCAL_ACTIVE:-}" != "${ROOT_DIR}" ]]; then
|
|
7
|
+
exec node "$ROOT_DIR/.cozeproj/scripts/local-workspace.cjs" dev "$@"
|
|
8
|
+
fi
|
|
6
9
|
COZE_WORKSPACE_PATH="${COZE_WORKSPACE_PATH:-${ROOT_DIR}}"
|
|
7
10
|
export COZE_WORKSPACE_PATH
|
|
8
11
|
cd "${COZE_WORKSPACE_PATH}"
|
|
@@ -10,7 +13,7 @@ cd "${COZE_WORKSPACE_PATH}"
|
|
|
10
13
|
# ---------------------------------------------------------
|
|
11
14
|
# 项目级日志目录
|
|
12
15
|
# ---------------------------------------------------------
|
|
13
|
-
LOG_DIR="${COZE_WORKSPACE_PATH}/logs"
|
|
16
|
+
LOG_DIR="${COZE_LOG_DIR:-${COZE_WORKSPACE_PATH}/logs}"
|
|
14
17
|
LOG_FILE="${LOG_DIR}/dev.log"
|
|
15
18
|
PID_FILE="${LOG_DIR}/dev.pid"
|
|
16
19
|
DEV_PID=""
|
|
@@ -119,8 +122,15 @@ process_belongs_to_workspace() {
|
|
|
119
122
|
|
|
120
123
|
case "${cwd}" in
|
|
121
124
|
"${COZE_WORKSPACE_PATH}"|"${COZE_WORKSPACE_PATH}"/*) return 0 ;;
|
|
122
|
-
*) return 1 ;;
|
|
123
125
|
esac
|
|
126
|
+
|
|
127
|
+
if [[ -n "${COZE_TARO_SOURCE_PATH:-}" ]]; then
|
|
128
|
+
case "${cwd}" in
|
|
129
|
+
"${COZE_TARO_SOURCE_PATH}"|"${COZE_TARO_SOURCE_PATH}"/*) return 0 ;;
|
|
130
|
+
esac
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
return 1
|
|
124
134
|
}
|
|
125
135
|
|
|
126
136
|
process_group_belongs_to_workspace() {
|
|
@@ -214,7 +224,9 @@ cleanup_previous_run() {
|
|
|
214
224
|
# ---------------------------------------------------------
|
|
215
225
|
echo "📦 Installing dependencies..."
|
|
216
226
|
PNPM_BIN="$(command -v pnpm)"
|
|
217
|
-
|
|
227
|
+
if [[ "${COZE_TARO_LOCAL_MIRROR:-}" != "1" ]]; then
|
|
228
|
+
bash "$ROOT_DIR/.cozeproj/scripts/prepare-node-modules.sh" --prefer-frozen-lockfile --prefer-offline
|
|
229
|
+
fi
|
|
218
230
|
echo "✅ Dependencies installed successfully!"
|
|
219
231
|
|
|
220
232
|
# ---------------------------------------------------------
|
|
@@ -256,7 +268,7 @@ start_service() {
|
|
|
256
268
|
DEV_PID="$(spawn_detached \
|
|
257
269
|
"${COZE_WORKSPACE_PATH}" \
|
|
258
270
|
"${LOG_FILE}" \
|
|
259
|
-
"${PNPM_BIN}" dev)"
|
|
271
|
+
"$(command -v node)" "$ROOT_DIR/.cozeproj/scripts/local-workspace.cjs" watch "${PNPM_BIN}" dev)"
|
|
260
272
|
if [[ -z "${DEV_PID}" ]]; then
|
|
261
273
|
echo "❌ 无法获取 dev 后台进程 PID"
|
|
262
274
|
return 1
|
|
@@ -279,5 +291,45 @@ start_service() {
|
|
|
279
291
|
echo "PID file: ${PID_FILE}"
|
|
280
292
|
}
|
|
281
293
|
|
|
294
|
+
warmup_preview() {
|
|
295
|
+
local base="http://127.0.0.1:${PORT}"
|
|
296
|
+
local waited=0
|
|
297
|
+
|
|
298
|
+
if ! command -v curl >/dev/null 2>&1; then
|
|
299
|
+
echo "Warmup skipped: curl is not available."
|
|
300
|
+
return 0
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
echo "🔥 Warmup: waiting for web server to accept connections..."
|
|
304
|
+
while (( waited < 60 )); do
|
|
305
|
+
if curl -s -o /dev/null --max-time 3 "${base}/"; then
|
|
306
|
+
break
|
|
307
|
+
fi
|
|
308
|
+
sleep 2
|
|
309
|
+
waited=$(( waited + 2 ))
|
|
310
|
+
done
|
|
311
|
+
|
|
312
|
+
local app_config="${COZE_WORKSPACE_PATH}/src/app.config.ts"
|
|
313
|
+
local pages=""
|
|
314
|
+
if [[ -f "${app_config}" ]]; then
|
|
315
|
+
pages=$(grep -oE "[\"']pages/[^\"']+[\"']" "${app_config}" | tr -d "\"'" | sort -u || true)
|
|
316
|
+
fi
|
|
317
|
+
|
|
318
|
+
local p
|
|
319
|
+
for p in "/" "/app.config.ts"; do
|
|
320
|
+
echo "🔥 Warmup ${p}"
|
|
321
|
+
curl -s -o /dev/null --max-time 300 "${base}${p}" || echo "Warmup ${p} timed out or failed (ignored)."
|
|
322
|
+
done
|
|
323
|
+
for p in ${pages}; do
|
|
324
|
+
echo "🔥 Warmup /${p}.tsx"
|
|
325
|
+
curl -s -o /dev/null --max-time 300 "${base}/${p}.tsx" || echo "Warmup /${p}.tsx timed out or failed (ignored)."
|
|
326
|
+
done
|
|
327
|
+
}
|
|
328
|
+
|
|
282
329
|
echo "Starting HTTP services on port ${PORT} (web) and ${SERVER_PORT} (server)..."
|
|
283
330
|
start_service
|
|
331
|
+
|
|
332
|
+
if [[ "${COZE_TARO_LOCAL_MIRROR:-}" = "1" && "${COZE_DEV_SKIP_WARMUP:-0}" != "1" ]]; then
|
|
333
|
+
warmup_preview || true
|
|
334
|
+
echo "✅ Warmup finished (or timed out). Preview should load fast now."
|
|
335
|
+
fi
|