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

Update and deduplicate sub-dependencies using npx yarn-deduplicate yarn.lock #1900

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

lukaw3d
Copy link
Member

@lukaw3d lukaw3d commented Apr 20, 2024

Assigning a few extra people, in case you want to do the same in repos you maintain

rm -rf node_modules/ && yarn install
before: 35.19 seconds , 735 MB
after: 9.28 seconds , 573 MB

Copy link

github-actions bot commented Apr 20, 2024

Deployed to Cloudflare Pages

Latest commit: 27fb134233aa10c5c747a877f85f3f2ef97a54c5
Status:✅ Deploy successful!
Preview URL: https://0c5aeeea.oasis-wallet.pages.dev

This comment was marked as off-topic.

Copy link
Collaborator

@lubej lubej left a comment

Choose a reason for hiding this comment

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

LGTM, but why did this PR affect snapshot files formatting?

@lukaw3d
Copy link
Member Author

lukaw3d commented Apr 20, 2024

jest snapshots -> jest-styled-components -> @adobe/css-tools upgraded from 4.0.1 to 4.3.1 (difference starts at 4.0.2)

@lubej
Copy link
Collaborator

lubej commented Apr 21, 2024

jest snapshots -> jest-styled-components -> @adobe/css-tools upgraded from 4.0.1 to 4.3.1 (difference starts at 4.0.2)

yarn-deduplicate is a bit misleading(naming) then, as it updates the dependencies as well.

@buberdds
Copy link
Contributor

If we blindly update deps with "highest" deduplication strategy please at least mention this in a changelog. For me it is unexpected that we bump redux in this PR for example.

@matevz
Copy link
Member

matevz commented Apr 22, 2024

NPM hell never seem to stop amuse me. Why even having yarn.lock files, if it gets overridden by yarn-deduplicate? We can just hope that there are no bugs in the sub-sub-sub-package A caused by the common carrot version dependency in another sub-sub-package B, because A didn't test it.

@lukaw3d
Copy link
Member Author

lukaw3d commented Apr 22, 2024

@matevz Lock file is just for reproducibility. We can delete it and reinstall from just our package.json, and that would deduplicate too, but also update all transitive dependencies to their latest valid versions.

Each package still specifies which subdependecy versions it supports, e.g.
https://github.com/testing-library/jest-dom/blob/v6.1.5/package.json#L82-L83 "@adobe/css-tools": "^4.3.1",
https://github.com/styled-components/jest-styled-components/blob/v7.2.0/package.json#L56-L57 "@adobe/css-tools": "^4.0.1"
deduplicated to 4.3.1 (it wouldn't deduplicate if something needed "4.0.2" or "^3.1.1")

But yes, even these updates within supported ranges can add bugs

@lukaw3d lukaw3d force-pushed the lw/reduce-node_modules branch from ecddafb to fe5bc22 Compare April 22, 2024 21:51
@lukaw3d lukaw3d changed the title Reduce the size of node_modules using npx yarn-deduplicate yarn.lock Update and deduplicate sub-dependencies using npx yarn-deduplicate yarn.lock Apr 22, 2024
@lukaw3d
Copy link
Member Author

lukaw3d commented Apr 22, 2024

Updated changelog and commit message to:

Update and deduplicate sub-dependencies using `npx yarn-deduplicate yarn.lock`

This reduces the size of node_modules and speeds up installing dependencies.

lukaw3d added 2 commits April 22, 2024 23:53
Used `npx yarn-deduplicate yarn.lock`. This reduces the size of node_modules and
speeds up installing dependencies.
@lukaw3d lukaw3d force-pushed the lw/reduce-node_modules branch from fe5bc22 to 27fb134 Compare April 22, 2024 21:54
@lukaw3d lukaw3d merged commit 1abff77 into master Apr 22, 2024
13 checks passed
@lukaw3d lukaw3d deleted the lw/reduce-node_modules branch April 22, 2024 22:05
@matevz
Copy link
Member

matevz commented Apr 23, 2024

But yes, even these updates within supported ranges can add bugs

That's exactly what I fear yes. Mostly the carrot versioning is used in package.json and the package maintainers typically run tests on exact dependencies inside their yarn.lock file. Deduplication effectively bumps all of those and we will encounter bugs before the original package maintainers will.

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.

4 participants