diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5493447..e9026bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,9 +22,9 @@ Every change, from a person or an AI agent, follows the same path: | Setting | Value | |---|---| | Root directory | repo root | -| Build command | `pnpm install --frozen-lockfile && pnpm test && pnpm --filter website build` | +| Build command | optional: `apps/website/wrangler.jsonc` has a `build.command` that installs, builds the site and runs the post-build checks before every deploy and preview | | Deploy command | `pnpm --filter website exec wrangler deploy` | -| Other branches | `pnpm --filter website exec wrangler versions upload` (a preview URL per branch) | +| Other branches | `npx wrangler preview` (Cloudflare's default; gives each branch a preview URL, and needs the `previews` block in `wrangler.jsonc`) | Node comes from `.nvmrc` and pnpm from `packageManager` in `package.json`. A failing test or post-build check stops the deploy. diff --git a/apps/website/wrangler.jsonc b/apps/website/wrangler.jsonc index 4ccf7b0..055043f 100644 --- a/apps/website/wrangler.jsonc +++ b/apps/website/wrangler.jsonc @@ -4,6 +4,11 @@ "main": "worker/index.ts", "compatibility_date": "2026-10-28", "workers_dev": true, + // Wrangler builds the site before every deploy and preview, so CI needs no separate build step. + // `pnpm install` is a no-op when dependencies are already installed. + "build": { + "command": "pnpm install --frozen-lockfile && pnpm run build" + }, // Static assets are served first; the Worker only runs when no asset matches. "assets": { "directory": "./dist", @@ -12,5 +17,8 @@ }, // www.jscebu.org is attached as a Workers Custom Domain (Cloudflare manages its DNS // record and certificate). The apex jscebu.org still redirects to www via Vercel. - "routes": [{ "pattern": "www.jscebu.org", "custom_domain": true }] + "routes": [{ "pattern": "www.jscebu.org", "custom_domain": true }], + // Required by `wrangler preview`, which Workers Builds runs for non-production branches. + // Empty: previews reuse the top-level assets and compatibility settings, and get no routes. + "previews": {} }