# Task 5 Report: pack.sh PC build & copy (GREEN)

**Status:** ✅ SUCCESS

**Test:** `bash tests/deploy/baota/test-pack-web-hooks.sh` → PASS (6/6 greps)

**Files changed:** `deploy/baota/pack.sh` only

**Implemented:**
- `WEB_FRONTEND_DIR` default + header docs (Node 16 admin/mobile, Node 20 PC)
- `build_web_frontend`: Node ≥20 check, optional `WEB_NODE_BIN`, pnpm install/build with `NUXT_APP_BASE_URL=/web/` + `NUXT_PUBLIC_API_BASE=/api/h5app`
- `assert_web_output`: requires `.output/server/index.mjs`; optional `/web/` grep in public HTML
- `pack_frontend`: build when `PACK_FRONTEND_BUILD=true`; rsync to `STAGE/web/.output/`; validate staged `index.mjs`
- `PACK_FRONTEND=false` unchanged (skips all frontends)
- Log: `PC SSR → /web/ (web/.output)`

**Concerns:** Real Nuxt build not executed in this task; integration test with mock frontend recommended before release. Admin/mobile paths untouched.

---

## Task 5 Review Fixes (2026-08-13)

**Status:** ✅ SUCCESS

**Fixed:**
1. `assert_web_output`: if `.output/public` has any `*.html` but none contain `/web/`, now `die` with clear message; no HTML → `index.mjs` check only (unchanged).
2. `build_web_frontend`: subshell exports `PATH="$(dirname "$node_bin"):$PATH"` before pnpm so pnpm uses the same Node that passed the version gate.

**Verify:**
- `bash -n deploy/baota/pack.sh` → OK
- `bash tests/deploy/baota/test-pack-web-hooks.sh` → PASS (6/6 greps, contract unchanged)

**Files:** `deploy/baota/pack.sh` only (no test file changes needed)
