Appearance
play.mjs
Serves the built dist/ directory as a static local preview, with no /api.
Contributor tooling › play.mjs
What it does
Serves the contents of dist/ over a locally bound HTTP server, refusing to start when the built index.html is missing. Serves no /api route, so the game reaches only its landing screen. Binds an OS-assigned port and prints the origin it answers on.
Usage
The minimal invocation that works:
bash
npm run playThe equivalent direct form:
bash
node scripts/play.mjsOptions
No options.
Inputs and outputs
Reads: dist/ (built by npm run build) — refuses to start if its index.html is missing. Writes: nothing on disk.
Binds: 127.0.0.1 on a port the OS assigns (server.listen(0, ...)), not a fixed one. The actual origin is printed in the startup banner (the game http://127.0.0.1:<port>/), since it is not known in advance.
Stops: Ctrl-C or SIGTERM closes the listening server, destroys any open sockets, and exits 0.
Exit codes: 0 on a clean run or a clean stop; 1 if the built index.html is missing at startup.
Examples
Preview the exact bytes a deploy would ship, right after building them:
bash
npm run build && npm run playPreview again without rebuilding, when dist/ is already current:
bash
npm run playNotes
The port is chosen by the OS and printed at startup rather than fixed. A caller cannot assume it in advance, and has to read it from the banner or grep it from stdout.
Source
scripts/play.mjs — part of Contributor tooling