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

Expose data/helpers to check for no changes in bundle sizes to reduce noise #4153

Merged
merged 2 commits into from
Oct 29, 2020

Conversation

heliocliu
Copy link
Contributor

First part of #4124

Return the raw data from the bundle comparison in addition to the formatted output, and add a helper to check if that raw data represents no size changes.

Next steps are to publish the new version of this package, and update build-tools to make this check before posting a size comment.

@heliocliu heliocliu requested a review from arinwt October 29, 2020 01:45
@github-actions github-actions bot requested a review from curtisman October 29, 2020 01:45
* @param comparisons
*/
export function bundlesContainNoChanges(comparisons: BundleComparison[]): boolean {
for (let i = 0; i < comparisons.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

non-functional

Thoughts?
for (const { commonBundleMetrics } of comparisons) {

And below:

const metrics = Object.values(commonBundleMetrics); // values ignores keys
for (const { baseline, compare } of metrics) {

Or an unreadable(?) one-liner:

comparisons.every(({ commonBundleMetrics }) => Object.values(commonBundleMetrics)
    .every(({ baseline, compare }) => baseline.parsedSize === compare.parsedSize));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i like the unreadable one but the other one is good too

@heliocliu heliocliu merged commit cee4f27 into microsoft:main Oct 29, 2020
@heliocliu heliocliu deleted the ReduceSizeAnalysisNoise branch October 29, 2020 21:54
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.

2 participants