Files
Dylan M. Taylor 999b402564 Stop rebuilding the website during wrangler deploy (#410)
## What the log shows

The Cloudflare build for `artcraft-services` succeeded, then failed
during
deploy:

```
04:52:46  Success: Build command completed
04:52:47  Executing user deploy command: npx wrangler deploy
04:52:56  [custom build] Running: npm run build        <-- build runs again
04:53:35  [custom build] Generating static Linux repositories and Flatpak OCI catalog...
04:53:46  [custom build] DOMException [TimeoutError] at fetchHeadPackageSize (linux-repos.ts:274)
          [custom build] Error: Command failed: ... generate-static-repos.mjs
✘ [ERROR] Running custom build `npm run build` failed.
```

Two things combine:

1. The root `wrangler.jsonc` declared `"build": { "command": "npm run
build" }`.
Workers Builds already runs the project's build command, so `wrangler
deploy`
   rebuilt the entire static export a second time.
2. The second pass re-probed every published package on GitHub (523
package
redirects, 19 OCI repos). `fetchHeadPackageSize` treats one 10s HEAD
timeout
   as fatal, so the repeat pass — running ~50s behind the first burst of
   identical requests — failed the deploy.

This is not a regression from #408 or #409: neither touches the website
build.
The `build.command` has been in the config since #354, and the failing
probe is
pre-existing.

## Changes

- `wrangler.jsonc`: remove `build.command`, with a comment explaining
why. The
deploy now uploads the `out/` that Workers Builds just produced,
matching how
the webapp and dashboard Workers already behave. A manual `wrangler
deploy`
  needs `npm run build:website` first.
- `linux-repos.ts`: `fetchHeadPackageSize` retries three times with a
short
  backoff instead of failing the export on a single unanswered HEAD.

## Verification

- `npm ci --ignore-scripts && npm run typecheck` in
  `frontend/apps/artcraft-website-next` — exit 0.
- `wrangler deploy --dry-run --config wrangler.jsonc` against a
placeholder
`out/` parses the config and skips straight to bundling: no `[custom
build]`
pass, which is the behavior this PR is after. The dry-run cannot
complete
locally because `worker/index.mjs` imports `generated-catalog.mjs`,
which the
  full build generates.
- Not run: the Playwright `test:repos` suite, which needs the deployed
preview.

## Risk

- Deploying the website by hand now needs an explicit build first:
  `npm run build:website && npm run deploy:website`. On a clean checkout
`wrangler deploy` fails loudly ("Could not resolve
./generated-catalog.mjs")
because both `out/` and `worker/generated-catalog.mjs` are gitignored
build
  artifacts.
- This assumes the Worker keeps a build command configured in Workers
Builds
(the failing log shows `npm run build`). If that field is cleared, the
deploy
  step has no artifacts to upload.
2026-11-18 00:14:37 -05:00

37 lines
1.1 KiB
JSON

{
"name": "artcraft-services",
"compatibility_date": "2026-11-06",
"main": "frontend/apps/artcraft-website-next/worker/index.mjs",
// Deliberately no `build.command`: Workers Builds already runs this project's
// build command before the deploy command, and declaring it here made
// `wrangler deploy` rebuild the whole site a second time. That second pass
// repeated every GitHub release probe and failed the deploy on a timeout.
// Deploying by hand therefore needs `npm run build:website` first.
"assets": {
"directory": "./frontend/apps/artcraft-website-next/out",
"binding": "ASSETS",
"run_worker_first": [
"/checkout_success",
"/checkout_cancel",
"/portal_closed",
"/apps/loopcraft",
"/apps/drawcraft",
"/apps/printcraft",
"/images/apps/loopcraft/*",
"/images/apps/printcraft/*",
"/tutorials/*",
"/apps/*/*-oci.flatpakref",
"/artcraft-oci.flatpakrepo",
"/index/*",
"/keys/*",
"/oci-signatures/*",
"/apt/*",
"/rpm/*",
"/arch/*",
"/media",
"/media/*"
]
},
"previews": {}
}