-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
[code infra] migrate to pnpm #2546
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.
Awesome!
@@ -16,21 +16,22 @@ | |||
"toolpad": "./dist/index.js" | |||
}, | |||
"scripts": { | |||
"preinstall": "npx only-allow pnpm", |
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.
Nitpick: I'm not sure how necessary is this.
Trying to run yarn
on a pnpm setup produces the following error:
error This project's package.json defines "packageManager": "yarn@[email protected]". However the current global version of Yarn is 1.22.21.
Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
Am I missing something or this script can actually be omitted? 🤔
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.
I believe that error only appears when corepack
is enabled. There are older versions of yarn
which would happily install even though the packageManager
field exists. e.g. I was able to install with [email protected]
(not through corepack
) when I remove the preinstall
script.
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.
Gotcha. Then it makes sense to add it in. 👌
Migrating yarn to pnpm
benchmark
I just compared 4 CI runs, not doing any serious statistics here
First number is cache restoration step, second number is the install step.
deduplication takes more time in pnpm than in yarn. We can mitigate the effect by only running it when the lock file has changed.