-
Notifications
You must be signed in to change notification settings - Fork 130
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
Adopt pnpm
as the default package manager
#870
Conversation
Thanks for your contribution! Depending on what you are working on, you may want to request a review from a Shopify team:
|
We detected some changes at packages/*/src and there are no updates in the .changeset. |
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.
🎩 passed ✅ and code LGTM!
Reasons to move to pnpm
make sense, even though we then have yet another package manager :D
I just have some questions left :)
WHY are these changes introduced?
Despite Yarn having done a reasonably good job at managing the dependencies of the project, there are a few issues rooted in their design that might manifest on the user side and worse the experience contributing to the repo. In particular:
dependencies
that are not declared as their dependencies. This can go unnoticed when building and testing the packages locally and on CI. Some projects prefer to use ESLint to catch these issues.node_modules
) proved to be inconsistently unreliable leading toyarn install
failures that cause developers to either retry a build on CI or deletingnode_modules
locally and trying again.WHAT is this pull request doing?
I'm replacing Yarn with PNPM.
PNPM addresses the above issues first, by being more strict with the directory structure and the usage of
peerDependencies
, and second, by having a global cached that's accessed through symlinks. PNPM's has a more sophisticated caching system with a content-addressable store that leads to faster dependency installation.Even though the above issues might seem minor, they'll become more frequent as our monorepo grows. I'm confident this is a great step forward for contributors and users. Other projects like Vite or Vitest have already validated the tool and use it at a much larger scale than us.
Why not Yarn 2/3?
They made plug & play the default approach to expose the module graph to the runtime and it's not compatible with ESM yet. The API they'd need to build upon, loaders, it's flag as experimental in Node. Moreover that approach is not conventional and therefore requires additional setup of our transpilation tools and workflows to make them work. This will make the project harder to reason about.
How to test your changes?
rm -rf node_modules/ **/node_modules
&pnpm install
pnpm build && pnpm lint && pnpm test
yarn
should output a message telling you to usepnpm
instead.Measuring impact
How do we know this change was effective? Please choose one:
Checklist
dev
ordeploy
have been reflected in the internal flowchart.