-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[code-infra] Use catalog for reused dependencies
#18302
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
Conversation
|
Deploy preview: https://deploy-preview-18302--material-ui-x.netlify.app/ Bundle size reportTotal Size Change: 0B(0.00%) - Total Gzip Change: 0B(0.00%) |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
| 'package.json needs to have a dependency on `@babel/runtime` when building with `@babel/plugin-transform-runtime`.', | ||
| ); | ||
| } else if (babelRuntimeVersion === 'catalog:') { | ||
| const listedBabelRuntime = execSync('pnpm list "@babel/runtime" --json'); |
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.
Babel was unhappy with the catalog: version. 🙈 😆
| ); | ||
| } else if (babelRuntimeVersion === 'catalog:') { | ||
| // resolve the version from the given package | ||
| const { stdout: listedBabelRuntime } = await exec('pnpm list "@babel/runtime" --json'); |
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.
Same here.
| checkMaterialVersion({ | ||
| packageJson, | ||
| materialPackageJson, | ||
| packageDirectory: 'packages/x-charts-pro', |
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.
Can't we use something like import.meta.url like we use in the vitest configs? Passing the current package path can be error prone, like if we use packages/x-data-grid on a charts package we will get the wrong results https://github.com/mui/mui-x/blob/master/vitest.config.mts#L5
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.
Good idea. 👍
Updated the solution.
Let me know what you think. 🙏
| // take only relevant part of the file path | ||
| // e.g. file:///Users/dev/mui/mui-x/packages/x-charts-pro/src/tests/materialVersion.test.tsx | ||
| // becomes packages/x-charts-pro | ||
| const workingDirectory = testFilePath.substring( |
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've gone with a basic solution to avoid issues on Vite/browser (it didn't like node API).
Use https://pnpm.io/catalogs to manage dependencies, which are used in at least 2 places.