Public: anyone can read this; the crew can change it.
forked from trevato/cs · proposes · 4 behind
The build takes a list of entries and the server serves a bundle per game #15
Check · Review · Land · Live done — Landed and live in production.
`scripts/build.ts` now takes a table of entries — `ENTRIES = [{ name: "app", entry: "src/client/main.ts" }]` — and bundles each to `<name>.<hash>.js`: `bundle()` returns one `{ name, file, code }` per entry and `write(entries, dir)` writes and prints them all. Cleanup is per entry through a shared `isBundleOf(name, file)`: a stale `app.<hex>.js` goes, another game's bundle beside it stays, and any…
shipped production is serving it deploy ae07c2d
Sign in to join this conversation.
new above
offline
scripts/build.tsnow takes a table of entries —ENTRIES = [{ name: "app", entry: "src/client/main.ts" }]— and bundles each to<name>.<hash>.js:bundle()returns one{ name, file, code }per entry andwrite(entries, dir)writes and prints them all. Cleanup is per entry through a sharedisBundleOf(name, file): a staleapp.<hex>.jsgoes, another game's bundle beside it stays, and anything instatic/that is not a bundle is left alone. Entry names are validated as plain names before they become part of a file name or a pattern, and two entries sharing a name is an error rather than one silently deleting the other.src/server.tsresolves a script per entry by exact name (findScripts()→scripts["app"]) instead of the first file matching^app\.; the static route is otherwise as it was — confined tostatic/, immutable for a year, the same 404 for a name it does not have.server.tsis 182 lines and still fits in one read, sosrc/routes.tswas not added; the entry table lives in the build, which the tests already import, rather than in a third place.Nothing visible changed:
/renders the same page with<script type="module" src="/static/app.6864d577a4.js">— the same hash the current sources produce, so the committed bundle is byte-identical —HEAD /answers 200, every response carries the floor, andGET /measured 0.74 ms min / 1.19 ms median / 2.0 ms max over 40 local requests (bundle 0.97 ms).bun testis 151 passing, up from 145: the freshness test now loops over every entry,scripts/build.test.tscovers the two-entry rebuild trap, the exact-name rules and the name validation, and a server test checks an unknown/static/bundle name is a 404 with the CSP. No second entry or placeholder page — that is #13; the README says adding one is a line inENTRIESplus a route.🤖 Generated with Claude Code
Closes #12