This commit is contained in:
ZuoZuo 2026-04-23 01:27:21 +08:00
parent e6d6bc4074
commit c1f528a72e

View File

@ -1049,21 +1049,21 @@ def build_frontend_bundle(
progress=progress, progress=progress,
) )
shim_dir = worktree_root / ".hy-app-monitor-bin"
shim_dir.mkdir(parents=True, exist_ok=True)
pnpm_shim = shim_dir / "pnpm"
pnpm_shim.write_text("#!/bin/sh\nexec corepack pnpm \"$@\"\n", encoding="utf-8")
pnpm_shim.chmod(0o755)
frontend_env = { frontend_env = {
"CI": "true", "CI": "true",
"NODE_OPTIONS": "--max-old-space-size=8192", "NODE_OPTIONS": "--max-old-space-size=8192",
"PATH": f"{shim_dir}:{os.environ.get('PATH', '')}",
} }
emit_progress(progress, "build.frontend", "准备 corepack / pnpm") emit_progress(progress, "build.frontend", f"已注入 pnpm shim{pnpm_shim}")
local_command_output(
["corepack", "enable"],
cwd=worktree_root,
label="frontend corepack enable",
env=frontend_env,
timeout_seconds=120,
)
emit_progress(progress, "build.frontend.install", "开始安装前端依赖") emit_progress(progress, "build.frontend.install", "开始安装前端依赖")
run_logged_command( run_logged_command(
["corepack", "pnpm", "install", "--frozen-lockfile"], ["pnpm", "install", "--frozen-lockfile"],
cwd=worktree_root, cwd=worktree_root,
label="frontend pnpm install", label="frontend pnpm install",
env=frontend_env, env=frontend_env,
@ -1073,7 +1073,7 @@ def build_frontend_bundle(
) )
emit_progress(progress, "build.frontend.build", f"开始构建静态站点:{ADMIN_FRONTEND_BUILD_SCRIPT}") emit_progress(progress, "build.frontend.build", f"开始构建静态站点:{ADMIN_FRONTEND_BUILD_SCRIPT}")
run_logged_command( run_logged_command(
["corepack", "pnpm", "run", ADMIN_FRONTEND_BUILD_SCRIPT], ["pnpm", "run", ADMIN_FRONTEND_BUILD_SCRIPT],
cwd=worktree_root, cwd=worktree_root,
label="frontend pnpm build", label="frontend pnpm build",
env=frontend_env, env=frontend_env,