feat(ci): assert gzip transfer sizes against ADR-0017 budgets #133
Reference in New Issue
Block a user
Delete Branch "feat/ci/gzip-transfer-size-budgets-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes the ADR-0017 follow-up that was sitting on an unpushed local branch (
feat/ci/gzip-transfer-size-budgets) for ~5 days, while ADRs 0018–0021 and the auth/admin/security tracks landed. Cherry-picked onto currentmain, with a small follow-up fix to make the script work against the locale-split build layout introduced by ADR-0019 between the two commits.What lands
Commit 1 —
feat(ci): assert gzip transfer sizes against ADR-0017 budgetsscripts/check-gzip-budgets.mjs— plain-Node, no deps, ~120 LOC at landing. Closes the ADR-0017 §Confirmation gap (Angular CLI'sbudgetsonly compare RAW sizes):index.htmlto separate initial assets (anything referenced viasrc=/href=) from lazy chunks (the rest).initial JS total ≤ 300 KB,any lazy chunk ≤ 100 KB,total CSS ≤ 150 KB) and exits non-zero on any breach.pnpm ci:gzip-budgetsinvokes the script with the default dist path.ci:perfchains build → gzip check → Lighthouse, so a budget breach short-circuits before Lighthouse even runs.ADR-0017 §Confirmation also updated to point at the script instead of describing it as a "future follow-up".
Commit 2 —
fix(ci): adapt gzip-budget check for the @angular/localize multi-bundle layoutThe original commit predated PR #91 / ADR-0019, which made
@angular/localizeemit one self-contained bundle per locale underdist/apps/portal-shell/browser/<locale>/. The script looked forindex.htmldirectly under the dist root and failed with ENOENT on every build since.Fix:
dist/index.htmlexists → flat mode (unchanged behaviour, kept for single-locale apps likeportal-admin). Otherwise enumerates immediate subdirectories with their ownindex.htmland runs the check per locale.Test plan
node --check scripts/check-gzip-budgets.mjs— syntax OK.pnpm ci:gzip-budgetsagainst the current production build:en,fr).package.jsondespite 11 PRs touching it since the branch base — cherry-pick auto-merged cleanly.pnpm ci:perfend-to-end (build → gzip-budgets → Lighthouse). Validates on the runner.Notes for the reviewer
scripts/rather than as an Nx target — it's a pure CI helper, not project-scoped. Matches the existingci:audit/ci:commitspattern inpackage.json.node:fs/promisesandnode:zlib.feat/ci/gzip-transfer-size-budgets) is preserved in local-only state for paranoia; once this PR merges, it can begit branch -D'd.