Skip to content

chore: add a bundle size summary to the build all examples script - #316

Merged
redfish4ktc merged 2 commits into
mainfrom
feat/build-script-size-summary
Oct 4, 2026
Merged

redfish4ktc merged 2 commits into
mainfrom
feat/build-script-size-summary

Conversation

@redfish4ktc

Copy link
Copy Markdown
Member

The bundle sizes of the examples are reported in PR descriptions, in the maxGraph release notes and in a follow-up spreadsheet, to track how the size of an app changes between maxGraph versions. Until now they had to be collected by hand from the per-file listing printed by build-all-examples.bash.

The script now ends with a Markdown table and a CSV line, in the same format as the build script of the maxGraph repository. It also works with --list-size-only.

How the size is computed

The maxGraph script keeps only the largest JS file of each example. That does not fit the bundlers used here, so the JS files of an example are summed instead:

  • Farm: both files are counted, as part of the maxGraph code is in the small one.
  • rsbuild: the index.*.js file is excluded, as it only holds the HTML generation and the app initialization.
  • SvelteKit: not included in the summary, as its server and client files cannot be told apart reliably for now.
  • An example without a dist directory is reported as N/A.

The app code is counted too. This is fine since it barely changes: the goal is to follow the variations between maxGraph versions, not the absolute contribution of maxGraph.

Output example

| Example | before | now |
| --- | --- | --- |
| farm-ts | kB | 401.49 kB |
| lit-ts | kB | 379.05 kB |
| parcel-ts | kB | 504.76 kB |
| rollup-ts | kB | 366.90 kB |
| rsbuild-ts | kB | 346.94 kB |
| vitejs-ts | kB | 363.25 kB |
farm-ts,lit-ts,parcel-ts,rollup-ts,rsbuild-ts,vitejs-ts
401.49,379.05,504.76,366.90,346.94,363.25

The sizes are reported in PR descriptions, in the maxGraph release notes and in a follow-up spreadsheet to track how
the size of an app changes between maxGraph versions. Collecting them from the per-file listing was manual, so the
script now ends with a Markdown table and a CSV line, in the same format as the build script of the maxGraph repository.

Unlike the maxGraph script, which keeps only the largest JS file, all JS files of an example are summed: Farm puts part
of the maxGraph code in its small file. The app code is counted too, which is fine since it barely changes and only the
variations matter. The rsbuild index file is excluded as it only holds the HTML generation and the app initialization.
SvelteKit is left out, as its server and client files cannot be told apart reliably for now.
@redfish4ktc redfish4ktc added the chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...) label Oct 4, 2026
SonarCloud flags a case statement without a default branch. All examples other than rsbuild keep every JS file, so
the default branch is intentionally empty.
@sonarqubecloud

sonarqubecloud Bot commented Oct 4, 2026

Copy link
Copy Markdown

@tbouffard tbouffard changed the title feat: add a bundle size summary to the build all examples script chore: add a bundle size summary to the build all examples script Oct 4, 2026
@redfish4ktc
redfish4ktc merged commit 1c60ebf into main Oct 4, 2026
9 checks passed
@redfish4ktc
redfish4ktc deleted the feat/build-script-size-summary branch October 4, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI/CD or repository tasks (issues/PR maintenance, environments, ...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant