-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[core] Change package manager to pnpm #36287
Conversation
I would be curious to see if it speed-up the CI, and by how much. It might be the biggest selling point. https://mui-org.notion.site/Migrate-to-pnpm-2a4f2e9869cf496eae183eff2aeef9a9 |
Yep, it already feels quite fast locally. I think there's two roads to continue with this
|
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 left few clarifying questions/comments. Would be great to validate them before merging.
@@ -14,7 +14,7 @@ | |||
"strict": true, | |||
"baseUrl": "./", | |||
"paths": { | |||
"react-docgen": ["../api-docs-builder/react-docgen.d.ts"] |
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.
Why is this no longe required?
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.
React-docgen types live in a separate package and are simply added as a dev dependency.
"@mui-internal/test-utils": "^1.0.0", | ||
"@mui-internal/babel-macros": "workspace:^", | ||
"@mui-internal/test-utils": "workspace:^", | ||
"@mui/base": "workspace:*", |
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.
Hmm, do we need to define the same package as its own dependency?
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.
Yes, otherwise, we won't be able to access the @mui/base
contents in tests.
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.
Got it!
@@ -94,10 +94,10 @@ const Badge = React.forwardRef(function Badge<RootComponentType extends React.El | |||
}) as PolymorphicComponent<BadgeTypeMap>; | |||
|
|||
Badge.propTypes /* remove-proptypes */ = { | |||
// ----------------------------- Warning -------------------------------- |
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.
These changes look unrelated, should we revert in order to have a smaller pull request?
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 had to change the yarn
to pnpm
in the message, so I figured I might as well fix the grammar and formatting bit. Revering those additional changes won't make the number of changed files smaller.
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.
Aaah, I missed that, I thought it is just the formatting. Got ya, let's keep them.
// | These PropTypes are generated from the TypeScript type definitions | | ||
// | To update them edit TypeScript types and run "yarn proptypes" | | ||
// ---------------------------------------------------------------------- | ||
// ┌────────────────────────────── Warning ──────────────────────────────┐ |
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 just left a comment above too. The pull request is anyways heavy, it would be great if we can revert this particular change.
@@ -1,6 +1,7 @@ | |||
{ | |||
"extends": "../../tsconfig.json", | |||
"compilerOptions": { | |||
"skipLibCheck": true, |
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.
What was failing here?
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.
Mismatched NextJS version. I just pinned the nextjs version and removed this compiler option.
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.
We are ready to go! 🎉 🚀
Co-authored-by: Michał Dudak <[email protected]>
Awesome, love to see this. |
I think I found a regression with pnpm: material-ui/packages/mui-base/package.json Lines 43 to 47 in 9e0af1b
As far as I can read this: we can no longer control the minimum version dependency, we are forced to force every developer to update all their dependencies even if there are no breaking changes or reliance on new features, leading to a higher chance of package duplication in the bundle (good for our npm downloads stats, not good for end-users) |
How is this different from the workflow we had with Yarn? We used to update the versions of internal dependencies each release to the most current one. Now it's done automatically by pnpm. Anyway, if you want to allow earlier versions, pnpm does allow to do it (for example |
@michaldudak It's simpler during the release process, and a lot less likely to do it wrong. But in theory, if we aren't dependent on the new feature, it's not necessary to increase the range.
Great to know 👍. So if we ever want to change the tradeoff, it looks like we are good. |
I thought we kept versioning in lerna, if lerna wasn't increasing the range before pnpm migration, it won't increase it after. Or am I missing something? |
@Janpot This indeed didn't change. The conclusion for me is:
|
The benefit of the
Those people should instead run npm info @mui/material
# or
pnpm info @mui/material
# or
yarn info @mui/material It's a much more reliable source for this information as it shows the actually published package. It's also much easier to find the dependencies of a specific version of a package by adding a version range |
I was curious about the CI metric impact of this PR:
|
Migrated the Core repo from Yarn Classic to pnpm.
Motivation and getting started with pnpm: https://mui-org.notion.site/pnpm-32e8449c77ce403a9f4582a86f1a6c79
Summary of the changes:
packageManager
field in the root package.jsonworkspace:
protocolSince the question came up in Slack. Just to see what a migration looks like. This PR mostly to see how the
@mui/monorepo
dependency will behave in X/ToolpadMigrated the repo up until
pnpm docs:dev
works. None of the other commands have been tested or migrated. Nothing in the CI pipeline has been migrated.Some quick notes
https://dev.to/andreychernykh/yarn-npm-to-pnpm-migration-guide-2n04
=> remove
**/
everywhere?added
.npmrc
withreplace workspace dependencies versions in package.json files with
workspace:*
scripts:
yarn workspace docs dev
=>pnpm --dir ./docs dev