Skip to content

Commit

Permalink
[code-infra] Add missing @babel/runtime dependency to @mui/material-p…
Browse files Browse the repository at this point in the history
…igment-css (#43473)

Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
  • Loading branch information
Janpot committed Sep 3, 2024
1 parent a889d9b commit f1d5fff
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ module.exports = function getBabelConfig(api) {
{
useESModules,
// any package needs to declare 7.25.0 as a runtime dependency. default is ^7.0.0
version: '^7.25.0',
version: process.env.MUI_BABEL_RUNTIME_VERSION || '^7.25.0',
},
],
[
Expand Down
1 change: 1 addition & 0 deletions packages/mui-material-pigment-css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"typescript:module-augmentation": "node scripts/testModuleAugmentation.js"
},
"dependencies": {
"@babel/runtime": "^7.25.0",
"@mui/system": "workspace:*",
"@pigment-css/react": "0.0.21"
},
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import glob from 'fast-glob';
import path from 'path';
import { promisify } from 'util';
import yargs from 'yargs';
import * as fs from 'fs/promises';
import { getVersionEnvVariables, getWorkspaceRoot } from './utils.mjs';

const exec = promisify(childProcess.exec);
Expand All @@ -25,10 +26,21 @@ async function run(argv) {
);
}

const packageJsonPath = path.resolve('./package.json');
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, { encoding: 'utf8' }));

const babelRuntimeVersion = packageJson.dependencies['@babel/runtime'];
if (!babelRuntimeVersion) {
throw new Error(
'package.json needs to have a dependency on `@babel/runtime` when building with `@babel/plugin-transform-runtime`.',
);
}

const env = {
NODE_ENV: 'production',
BABEL_ENV: bundle,
MUI_BUILD_VERBOSE: verbose,
MUI_BABEL_RUNTIME_VERSION: babelRuntimeVersion,
...(await getVersionEnvVariables()),
};

Expand Down

0 comments on commit f1d5fff

Please sign in to comment.