-
Notifications
You must be signed in to change notification settings - Fork 370
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
Deduplicate yarn packages #1549
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, good idea!
If the tests pass then let's give it a try. if things break we can revert
Codecov Report
@@ Coverage Diff @@
## master #1549 +/- ##
========================================
Coverage 74.26% 74.26%
========================================
Files 277 277
Lines 7617 7617
Branches 669 953 +284
========================================
Hits 5657 5657
Misses 1845 1845
Partials 115 115
Continue to review full report at Codecov.
|
Awesome! |
3488435
to
86108d2
Compare
Ran: npx yarn-deduplicate yarn.lock && yarn
0176b90
to
1755785
Compare
Description
yarn deduplication is currently not optimal. After a while of adding/updating/removing packages, some duplicated versions are installed even if they have compatible semver ranges!
See yarnpkg/yarn#3778 and https://medium.com/@bnaya/yarn-deduplicate-the-hero-we-need-f4497a362128
Until yarn fixes this (hopefully in yarn v2) we can use this tool https://github.com/atlassian/yarn-deduplicate to limit this duplication.
For this PR, I ran the following:
npx yarn-deduplicate yarn.lock && yarn
Here are the results on my machine (late 2013 MacBook Pro):
yarn.lock
went from4307
to3868
(~10% reduction).3.8G
to3.4G
(saved ~400MB, also ~10% reduction)yarn install
time with a clean yarn cache (yarn reset
has been run) went from3m46s
to3m20s
(~8% reduction)This includes download time of the packages which may vary depending on network conditions.
yarn install
time with a populated yarn cache (yarn reset-modules
has been run, so node_modules are empty) went from2m29s
to2m0s
(~20% reduction).This doesn't require downloading packages since the local yarn cache is populated.
Important: this changes our dependency tree. There are certain code paths that now will run with a different set of dependencies.
Tested
Before the changes
Unique packages in
yarn.lock
:1st run
yarn install
with a clean yarn cache (yarn reset
has been run before starting this):2nd run
yarn install
with a populated yarn cache (yarn reset-modules
has been run before starting this):After the changes
Unique packages in
yarn.lock
:1st run
yarn install
with a clean yarn cache (yarn reset
has been run before starting this):2nd run
yarn install
with a populated yarn cache (yarn reset-modules
has been run before starting this):Backwards compatibility
Yes.