Split the game page into partials under src/, assembled into one index.html at build
site/index.html (900 KB of HTML, CSS and JS in one file) becomes src/: a shell (src/index.html), styles/ and game/, concatenated in path order by scripts/lib/page.js. The assembled page is byte-identical to the old file, so load time and in-game performance are unchanged. - scripts/build.js replaces build.sh (same env vars, same output) - npm run dev: a zero-dependency dev server that assembles on every request - tests assemble the page in memory; npm test runs every tests/*.test.js - perf-bench takes --base-ref to build a git ref's page - scripts/legacy/split-index-html.js is the splitter, kept for older branches
This commit is contained in:
parent
295e68cc46
commit
67a40942b4
113 changed files with 5584 additions and 5195 deletions
16
scripts/test.js
Normal file
16
scripts/test.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env node
|
||||
// Runs every tests/*.test.js, one file at a time. New test files are picked up on their own, so adding
|
||||
// one never touches package.json (and never conflicts with someone else adding theirs).
|
||||
//
|
||||
// npm test everything
|
||||
// npm test -- tests/peering.test.js just these files (other arguments go to node --test)
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { spawnSync } = require('node:child_process');
|
||||
|
||||
const dir = path.join(__dirname, '..', 'tests');
|
||||
const args = process.argv.slice(2);
|
||||
const files = args.some((a) => a.endsWith('.test.js')) ? [] :
|
||||
fs.readdirSync(dir).filter((f) => f.endsWith('.test.js')).sort().map((f) => path.join('tests', f));
|
||||
const r = spawnSync(process.execPath, ['--test', '--test-concurrency=1', ...args, ...files], { stdio: 'inherit', cwd: path.join(__dirname, '..') });
|
||||
process.exit(r.status ?? 1);
|
||||
Loading…
Add table
Add a link
Reference in a new issue