rogue-racer.html at the repo root is GENERATED. Do not hand-edit it. Edit the files
here, then run the build.
The whole game used to be one ~17.5k-line rogue-racer.html. It's now split into:
index.html— the shell:<head>, the<style>block, the PeerJS<script src>, and a// @@BUNDLE@@marker inside an empty<script>where the game code gets injected.NNN-*.js— the game code, one file per// ====subsystem. These are plain scripts sharing one global scope (the sameGobject, functions calling each other freely) — there are noimport/exports. The numeric prefix is concatenation order (config and state load first; render/terminal reference everything, so they load last). Gaps of 10 leave room to insert new sections.
bun build.ts reads NNN-*.js in prefix order, concatenates them with newlines, and
substitutes the result into index.html's marker to produce the root rogue-racer.html.
Because it's plain concatenation, the built file is byte-for-byte what the single file was.
Fastest loop — dev server with hot reload:
bun run dev # http://localhost:8080, rebuilds on save + auto-reloads the browserOr build manually:
# edit files under src/, then:
bun run build # regenerates ../rogue-racer.html
git add src/ rogue-racer.htmlEnable the freshness guard once per clone so a stale/hand-edited artifact can't be committed:
bun run hooks # sets core.hooksPath to .githooks (installs the pre-commit check)bun run check rebuilds and fails if the committed rogue-racer.html doesn't match src/.
- New subsystem → add
NNN-name.jswith a prefix that places it correctly in load order. - Splitting a big file further → keep prefixes ordered; the build just globs
NNN-*.js. - Editing the DOM, CSS, or
<head>→ that'sindex.html, not a.jsfile.
The self-updating loader (desktop/bootstrap.html) still document.writes a single
rogue-racer.html, and pushing that file to main still ships the game. The split only
changes how developers edit it — see ../docs/features/rebuild-plan.md.