Skip to content

build: round payload size for comparison #7174

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

Merged
merged 1 commit into from
Sep 28, 2017

Conversation

devversion
Copy link
Member

@devversion devversion commented Sep 19, 2017

In some cases the payload is still showing up in the CI even if there was no change to the library. This seems to be because the file sizes are not rounded and can sometimes be not very exact. Resulting in numbers like: material_fesm_2014": 1004.1319999999998.

To have a more readable output in the gulp task, the file sizes should be rounded. This also makes the diff comparsion in the Firebase function better.

See PRs like: #7169

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 19, 2017
@devversion devversion force-pushed the build/round-payload-size branch from 50a8c18 to 7d579fe Compare September 19, 2017 15:34
@@ -93,10 +93,10 @@ async function calculatePayloadDiff(database: firebaseAdmin.database.Database, c

// Calculate the payload diffs by subtracting the previous size of the FESM ES2015 bundles.
const cdkFullSize = currentPayload.cdk_fesm_2015;
const cdkDiff = cdkFullSize - previousPayload.cdk_fesm_2015;
const cdkDiff = roundFileSize(cdkFullSize - previousPayload.cdk_fesm_2015);
Copy link
Member

Choose a reason for hiding this comment

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

Why not just use toFixed?

Copy link
Member Author

Choose a reason for hiding this comment

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

It returns a string instead of a number. I don't think re-parsing is better.

Copy link
Member

Choose a reason for hiding this comment

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

Generally you want to keep your values in number format as long as possible and them format them just before or past of displaying them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that's what this does now. toFixed() returns a string instead of a number. The formatting will happen in the Firebase function.

In some cases the payload is still showing up in the CI even if there was no change to the library. This seems to be because the file sizes are not rounded and can sometimes be not very exact. Resulting in numbers like: `material_fesm_2014": 1004.1319999999998`.

To have a better output in the GitHub statuses, the file size should be rounded
@devversion devversion force-pushed the build/round-payload-size branch from 7d579fe to 4f69d19 Compare September 21, 2017 15:33
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Sep 26, 2017
@jelbourn jelbourn merged commit 3948381 into angular:master Sep 28, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants