0284c9b83a
- Vitest units: board replay, placement machine, premium parity, i18n key parity, FlatBuffers codec round-trips (19 tests) - Playwright smoke (mock transport): guest -> lobby -> board -> place tile -> preview - ui-test.yaml workflow: check/unit/build + bundle-size budget (67.5KB gzip < 100KB) + chromium e2e - gateway transcode tests for games.list (seat display_name), pass, hint - backend integration test for game.ListForAccount
22 lines
817 B
JavaScript
22 lines
817 B
JavaScript
// Bundle-size budget gate. Sums the gzipped size of the built app JS and fails if it
|
|
// exceeds the budget — a guard against an accidental heavy dependency. The real
|
|
// transport build is ~69 KB gzip today; the budget leaves headroom.
|
|
import { readdirSync, readFileSync } from 'node:fs';
|
|
import { gzipSync } from 'node:zlib';
|
|
|
|
const BUDGET = 100 * 1024; // gzip bytes for app JS
|
|
const dir = 'dist/assets';
|
|
|
|
let total = 0;
|
|
for (const f of readdirSync(dir)) {
|
|
if (!f.endsWith('.js')) continue;
|
|
const gz = gzipSync(readFileSync(`${dir}/${f}`)).length;
|
|
total += gz;
|
|
console.log(`${f}: ${(gz / 1024).toFixed(1)} KB gzip`);
|
|
}
|
|
console.log(`total app JS: ${(total / 1024).toFixed(1)} KB gzip (budget ${BUDGET / 1024} KB)`);
|
|
if (total > BUDGET) {
|
|
console.error('bundle exceeds size budget');
|
|
process.exit(1);
|
|
}
|