spb/earth-now Public License
earth-now.co — real-time planetary dashboard: live world metrics modeled, not streamed.
TypeScript 93%
Shell 2.3%
SQL 1.4%
JavaScript 1.3%
Dockerfile 1.2%
CSS 0.8%
1/**2 * earth-now.co3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * File: packages/widget/scripts/check-size.mjs6 * Purpose: Build gate — fail the widget build if dist/widget.js exceeds the 15 KB gzip budget7 */89import { readFileSync } from "node:fs";10import { gzipSync } from "node:zlib";1112const LIMIT_BYTES = 15 * 1024;1314const bundlePath = new URL("../dist/widget.js", import.meta.url);15let raw;16try {17 raw = readFileSync(bundlePath);18} catch {19 console.error("✗ check-size: dist/widget.js not found — run the esbuild step first");20 process.exit(1);21}2223const gzipped = gzipSync(raw, { level: 9 }).length;24console.log(25 `widget.js: ${raw.length} B raw, ${gzipped} B gzip (budget ${LIMIT_BYTES} B gzip)`,26);2728if (gzipped > LIMIT_BYTES) {29 console.error(30 `✗ widget.js is ${gzipped - LIMIT_BYTES} B over the 15 KB gzip budget — trim it before shipping`,31 );32 process.exit(1);33}34console.log("✓ widget.js is within the 15 KB gzip budget");35