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

[Danger] Include 1% changes in a build, not just greater than #12213

Merged
merged 1 commit into from
Feb 12, 2018

Conversation

orta
Copy link
Contributor

@orta orta commented Feb 12, 2018

Thanks for #12210 @gaearon - I'd been running mostly in the dark and faking data, now have an easy PR to test against!

The main change is:

-        Math.abs(r.prevFileSizeChange) > percentToWarrentShowing ||
-        Math.abs(r.prevGzipSizeChange) > percentToWarrentShowing
+        Math.abs(r.prevFileSizeChange) >= percentToWarrentShowing ||
+        Math.abs(r.prevGzipSizeChange) >= percentToWarrentShowing

It means that a 1% change will show 👍

Which means it'll get picked up and shown. The other changes are to loosen up the constraint on highlighting when either react or react-dom changes outside of the closed table.

When I run yarn danger pr https://github.com/facebook/react/pull/12210 (after checking out the branch, and running yarn build to get the right results.json), the output by Danger is this:


ReactDOM: size +1%, gzip: +1%

Details of bundled changes.

Comparing: c7ce009...232208e

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.development.js -1% -1% 577.79 KB 577.78 KB 135.49 KB 135.49 KB UMD_DEV
react-dom.production.min.js 🔺+1% 🔺+1% 94.51 KB 95.86 KB 30.71 KB 31.04 KB UMD_PROD
react-dom.development.js -1% -1% 562.17 KB 562.17 KB 131.37 KB 131.36 KB NODE_DEV
react-dom.production.min.js 🔺+1% 🔺+1% 93.26 KB 94.62 KB 29.9 KB 30.28 KB NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js -1% -1% 380.87 KB 380.87 KB 84.39 KB 84.39 KB UMD_DEV
react-art.production.min.js 🔺+1% 🔺+1% 84.77 KB 86.12 KB 26.31 KB 26.62 KB UMD_PROD
react-art.development.js -1% -1% 306.72 KB 306.72 KB 65.8 KB 65.8 KB NODE_DEV
react-art.production.min.js 🔺+2% 🔺+2% 49.56 KB 50.93 KB 15.63 KB 16.06 KB NODE_PROD

react-test-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-test-renderer.development.js -1% -1% 303.76 KB 303.76 KB 64.77 KB 64.77 KB NODE_DEV
react-test-renderer.production.min.js 🔺+2% 🔺+3% 48.07 KB 49.43 KB 14.96 KB 15.42 KB NODE_PROD

react-noop-renderer

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-noop-renderer.development.js -1% 0% 18.34 KB 18.34 KB 5.18 KB 5.18 KB NODE_DEV
react-noop-renderer.production.min.js 🔺+8% 🔺+4% 6.28 KB 6.79 KB 2.51 KB 2.62 KB NODE_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler.development.js -1% -1% 285.66 KB 285.66 KB 60.32 KB 60.31 KB NODE_DEV
react-reconciler.production.min.js 🔺+3% 🔺+2% 41.45 KB 42.82 KB 13.04 KB 13.4 KB NODE_PROD

dangerfile.js Outdated
r => r.bundleType === 'UMD_PROD' && r.packageName === 'react'
r =>
r.packageName === 'react' &&
(r.prevFileSizeChange !== 0 || r.prevGzipSizeChange !== 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you explain this change? I don't get it.

We were specifically looking for the UMD prod bundle earlier because that's the one we consider the "React size".

Same below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I initially thought when looking at that code that a different version of those libs could slip through the net and not raise a warning. But you're right, the highlights are specifically for the prod user-facing builds, so I've reverted the change

@orta orta force-pushed the dangerfile_more_permissive branch from 6868d81 to 59b399a Compare February 12, 2018 03:21
@gaearon gaearon merged commit a634e53 into facebook:master Feb 12, 2018
@gaearon
Copy link
Collaborator

gaearon commented Feb 12, 2018

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants