Skip to content

Generate and analyse esbuild bundle metadata#3787

Open
mbg wants to merge 6 commits intomainfrom
mbg/bundle/metadata
Open

Generate and analyse esbuild bundle metadata#3787
mbg wants to merge 6 commits intomainfrom
mbg/bundle/metadata

Conversation

@mbg
Copy link
Copy Markdown
Member

@mbg mbg commented Mar 27, 2026

Modifies the esbuild script to write bundle metadata to disk and adds a small script to print the bundle sizes. The script is run at the end of the build process. We can extend this in the future to provide more detailed insights.

Risk assessment

For internal use only. Please select the risk level of this change:

  • Low risk: Changes are fully under feature flags, or have been fully tested and validated in pre-production environments and are highly observable, or are documentation or test only.

Which use cases does this change impact?

Environments:

  • Testing/None - This change does not impact any CodeQL workflows in production.

How did/will you validate this change?

  • Other - Please provide details.

If something goes wrong after this change is released, what are the mitigation and rollback strategies?

  • Development/testing only - This change cannot cause any failures in production.

How will you know if something goes wrong after this change is released?

  • Other - Please provide details.

Are there any special considerations for merging or releasing this change?

  • No special considerations - This change can be merged at any time.

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Consider adding a changelog entry for this change.
  • Confirm the readme and docs have been updated if necessary.

@mbg mbg self-assigned this Mar 27, 2026
@github-actions github-actions bot added the size/S Should be easy to review label Mar 27, 2026
@mbg mbg marked this pull request as ready for review March 27, 2026 19:01
@mbg mbg requested a review from a team as a code owner March 27, 2026 19:01
Copilot AI review requested due to automatic review settings March 27, 2026 19:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the build tooling to generate esbuild metafile output on disk and adds a small pr-checks utility script to print bundle sizes, enabling easier tracking of bundle growth over time.

Changes:

  • Enable esbuild metafile generation and write the metafile to meta.json during build.mjs.
  • Add pr-checks/bundle-metadata.ts and run it at the end of npm run build to print output sizes.
  • Refactor pr-checks GitHub API client construction into a shared api-client.ts module.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pr-checks/sync-checks.ts Switches to a shared API client helper.
pr-checks/api-client.ts New shared Octokit client type + constructor.
pr-checks/config.ts Adds a constant for the esbuild metafile path.
pr-checks/bundle-metadata.ts New script that reads the metafile and prints bundle sizes.
build.mjs Enables esbuild metafile output and writes it to disk.
package.json Runs the bundle-metadata script at the end of the build.
.gitignore Ignores the generated meta.json file.

@@ -0,0 +1,31 @@
#!/usr/bin/env npx tsx
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shebang #!/usr/bin/env npx tsx is not a valid /usr/bin/env invocation on many systems (because of the space). If this script is intended to be executable directly (as the require.main === module guard suggests), switch to a portable shebang (e.g. #!/usr/bin/env -S npx tsx where supported, or #!/usr/bin/env tsx and document the dependency), or remove the shebang if it will only ever be run via npx tsx ....

Suggested change
#!/usr/bin/env npx tsx
#!/usr/bin/env -S npx tsx

Copilot uses AI. Check for mistakes.
@mbg mbg force-pushed the mbg/bundle/metadata branch from bb1ce14 to f98bf5e Compare March 27, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Should be easy to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants