Skip to content

ci: add per-package bundle size tracking to PRs#4338

Merged
ScriptedAlchemy merged 4 commits intomainfrom
ci/bundle-size-report
Feb 4, 2026
Merged

ci: add per-package bundle size tracking to PRs#4338
ScriptedAlchemy merged 4 commits intomainfrom
ci/bundle-size-report

Conversation

@ScriptedAlchemy
Copy link
Member

Summary

  • Add bundle size CI that measures each package's dist/ output, compares PR vs base branch, and posts a markdown comparison table as a PR comment
  • Uses a two-workflow pattern (pull_requestworkflow_run) for fork security
  • Zero new dependencies — script uses only Node.js built-ins

Files added

  • scripts/bundle-size-report.mjs — measurement & comparison script (discovers type:pkg packages, measures total dist + ESM gzip)
  • .github/workflows/bundle-size.yml — build & measure workflow
  • .github/workflows/bundle-size-comment.yml — PR comment workflow

Test plan

  • Script syntax validated (node --check)
  • Measure mode tested locally — discovers 36 packages, outputs JSON with sizes
  • Compare mode tested with identical data — outputs "No bundle size changes detected"
  • Compare mode tested with simulated deltas — renders markdown table with correct formatting, bolds >5% changes

🤖 Generated with Claude Code

Add bundle size CI that measures each package's dist/ output, compares
PR vs base branch, and posts a markdown table as a PR comment.

- scripts/bundle-size-report.mjs: zero-dependency measurement & comparison script
- .github/workflows/bundle-size.yml: build & measure workflow (pull_request)
- .github/workflows/bundle-size-comment.yml: PR comment via workflow_run (fork-safe)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 1, 2026

⚠️ No Changeset found

Latest commit: e212e1d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Feb 1, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit e212e1d
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/6983d35443a67c0008e89610
😎 Deploy Preview https://deploy-preview-4338--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75a8ff04bd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 60 to 63
if (entry.isDirectory()) {
// Skip src/ directories (source maps / original source)
if (entry.name === 'src') continue;
total += dirSize(fullPath);

Choose a reason for hiding this comment

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

P2 Badge Count dist/src outputs in total dist size

The size calculation skips any directory named src, which means packages that emit their build output to dist/src (e.g., several packages’ main/exports entries point at dist/src/index.js) will report a totalDist of 0 or severely undercounted. In those cases the “Total dist” column and deltas become meaningless even when the compiled output changes, so bundle size regressions in those packages will be hidden.

Useful? React with 👍 / 👎.

@ScriptedAlchemy ScriptedAlchemy merged commit b1dac16 into main Feb 4, 2026
22 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the ci/bundle-size-report branch February 4, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant