Files
civitai__civitai/scripts/bundle-budget.mjs
T
Zachary Lowden 30c3bd69f4 feat(perf): serve per-route First Load JS as JSON (main bundle baseline) (#2591)
* feat(perf): serve per-route First Load JS as JSON for the main baseline

bundle-budget.mjs gains a --json flag that writes bundle-budget.json (machine-
readable per-route brotli First Load JS bytes + shared/total + commit/builtAt)
alongside the existing text report. The Dockerfile builder runs it with --json
and ships bundle-budget.json into the runner image; a new token-gated
/api/internal/bundle-budget route serves it.

On main (next.civitai.com) this becomes the baseline that:
  - the perf-trend job records over time (Grafana bundle-size trend), and
  - the future PR bundle-regression gate diffs a PR build against.

Report-only; no behavior change. The text report + the bundle-comment PR
surface are untouched.

* feat(perf): capture build commit SHA in the bundle snapshot

Declare ARG SOURCE_COMMIT + ENV in the builder stage so bundle-budget.mjs
--json records the commit (it already reads SOURCE_COMMIT). The Tekton build
forwards its COMMIT_SHA into this build-arg, making the served
/api/internal/bundle-budget snapshot commit-attributable (so a bundle-size jump
in the perf-trend Grafana view maps to a specific commit). Defaults empty
(commit:null) when built outside CI.

* chore: retrigger preview build (pick up SOURCE_COMMIT wiring)
2026-06-16 14:02:26 -05:00

6.4 KiB