ci(web): typecheck/lint/test/build + bundle-size budget

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-03 23:28:36 +02:00
parent 7170be016d
commit 89132f6745
3 changed files with 51 additions and 1 deletions
+29
View File
@@ -0,0 +1,29 @@
name: CI
on:
push:
branches: ["**"]
pull_request:
jobs:
web:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: web/pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm test
- run: pnpm build
- run: pnpm check:size
+2 -1
View File
@@ -11,7 +11,8 @@
"test:watch": "vitest", "test:watch": "vitest",
"typecheck": "tsc -b --noEmit", "typecheck": "tsc -b --noEmit",
"lint": "eslint .", "lint": "eslint .",
"gen:api": "openapi-typescript http://localhost:8080/api-docs/openapi.json -o src/api/schema.d.ts" "gen:api": "openapi-typescript http://localhost:8080/api-docs/openapi.json -o src/api/schema.d.ts",
"check:size": "node scripts/check-bundle-size.mjs"
}, },
"dependencies": { "dependencies": {
"@base-ui/react": "^1.5.0", "@base-ui/react": "^1.5.0",
+20
View File
@@ -0,0 +1,20 @@
// Fails if the largest built JS entry chunk exceeds the gzipped budget.
import { readdirSync, readFileSync } from "node:fs";
import { gzipSync } from "node:zlib";
import { join } from "node:path";
const BUDGET_KB = 150;
const dir = "dist/assets";
const jsFiles = readdirSync(dir).filter((f) => f.endsWith(".js"));
let largest = 0;
let largestName = "";
for (const file of jsFiles) {
const gz = gzipSync(readFileSync(join(dir, file))).length;
if (gz > largest) { largest = gz; largestName = file; }
}
const kb = (largest / 1024).toFixed(1);
console.log(`largest JS chunk: ${largestName} = ${kb} KB gz (budget ${BUDGET_KB} KB)`);
if (largest > BUDGET_KB * 1024) {
console.error(`bundle-size budget exceeded: ${kb} KB > ${BUDGET_KB} KB`);
process.exit(1);
}