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

Fix/file size reporter #5025

Merged
merged 2 commits into from
Sep 19, 2018
Merged

Fix/file size reporter #5025

merged 2 commits into from
Sep 19, 2018

Conversation

fiddep
Copy link
Contributor

@fiddep fiddep commented Sep 18, 2018

This PR addresses #4927

When getting the size of the previous build folder the paths were escaped
The screenshots are cluttered but the top part of the screen shots are the previousSizeMap before and after normalizing removeFileNameHash
The lower part is the asset.name before and after being run through removeFileNameHash
before: http://prntscr.com/kvw14e
after: http://prntscr.com/kvw0qs

Running the paths though the replace making sure they are all the same fixes the problem
result: http://prntscr.com/kvvwcp

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@@ -98,6 +98,7 @@ function printFileSizesAfterBuild(
function removeFileNameHash(buildFolder, fileName) {
return fileName
.replace(buildFolder, '')
.replace(/\\/g, '/')
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to just support both path separators in the below regex, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow.
The path are resolved differently from the start. These screens are before the change.
measureFileSizesBeforeBuild -> http://prntscr.com/kvxlyq
printFileSizesAfterBuild -> https://prnt.sc/kvxm6u

My solution was to just make sure they were always the same, if there is a smarter way sadly I'm not seeing it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I should've been clearer.
Is this because asset.name always returns paths with forward slashes (/)? If so, this patch makes perfect sense!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. While measureFileSizesBeforeBuild returns the path delimiter for the current os.

@Timer
Copy link
Contributor

Timer commented Sep 19, 2018

Awesome, thanks!

@Timer Timer added this to the 2.0.0 milestone Sep 19, 2018
@Timer Timer merged commit f11bea1 into facebook:next Sep 19, 2018
@lock lock bot locked and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants