Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Bundle size action #41

Merged
merged 6 commits into from
Nov 25, 2024
Merged

Feat: Bundle size action #41

merged 6 commits into from
Nov 25, 2024

Conversation

jackw
Copy link
Contributor

@jackw jackw commented Nov 8, 2024

This PR introduces a new action to surface frontend bundle size changes. It relies on the Github actions asset storage to track stats on the default branch. PRs will trigger stats builds and the actions script then compares the changes to asset and module sizes and if the total entrypoint difference is above the minimum threshold the action will post a comment on the PR with a breakdown. Various example comments using this action can be found here.

A standard comment where the size change of entrypoints is greater than the threshold can be seen here.

image

A similar comment that reduces size of entrypoints can be seen here.

image

A comment where a PR was previously above the minimum threshold but later falls within it can be seen here. I'm open to the idea of deleting it entirely as well but thought this more informative. 🤷

image

@jackw jackw added the enhancement New feature or request label Nov 8, 2024
@jackw jackw self-assigned this Nov 8, 2024
@jackw jackw changed the title [WIP] Feat: Bundle size action Feat: Bundle size action Nov 13, 2024
@jackw jackw marked this pull request as ready for review November 13, 2024 11:32
@jackw jackw requested review from a team as code owners November 13, 2024 11:32
@jackw jackw requested review from sunker, wbrowne, andresmgot and xnyo and removed request for a team November 13, 2024 11:32
@jackw jackw force-pushed the jackw/bundle-size-action branch from f800513 to 10007d4 Compare November 13, 2024 11:37

1. Replace the frontend build command so on pushes to main the stats.json file is generated by webpack:

```diff
Copy link
Member

Choose a reason for hiding this comment

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

which file is this? maybe let's use the one we use in our create-plugin template as example?

Copy link
Contributor Author

@jackw jackw Nov 25, 2024

Choose a reason for hiding this comment

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

I've updated the readme to mention file paths with the assumption that we're using create-plugin workflows.

@jackw jackw force-pushed the jackw/bundle-size-action branch from 0f14d2f to 68bdead Compare November 25, 2024 09:41
@jackw jackw merged commit d3d5153 into main Nov 25, 2024
1 check passed
@jackw jackw deleted the jackw/bundle-size-action branch November 25, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

2 participants