File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,18 @@ async function run(argv) {
41
41
const packageJson = JSON . parse ( await fs . readFile ( packageJsonPath , { encoding : 'utf8' } ) ) ;
42
42
43
43
let babelRuntimeVersion = packageJson . dependencies [ '@babel/runtime' ] ;
44
+ if ( babelRuntimeVersion === 'catalog:' ) {
45
+ // resolve the version from the given package
46
+ // outputs the pnpm-workspace.yaml config as json
47
+ const { stdout : configStdout } = await exec ( 'pnpm config list --json' ) ;
48
+ const pnpmWorkspaceConfig = JSON . parse ( configStdout ) ;
49
+ babelRuntimeVersion = pnpmWorkspaceConfig . catalog [ '@babel/runtime' ] ;
50
+ }
51
+
44
52
if ( ! babelRuntimeVersion ) {
45
53
throw new Error (
46
54
'package.json needs to have a dependency on `@babel/runtime` when building with `@babel/plugin-transform-runtime`.' ,
47
55
) ;
48
- } else if ( babelRuntimeVersion === 'catalog:' ) {
49
- // resolve the version from the given package
50
- const { stdout : listedBabelRuntime } = await exec ( 'pnpm list "@babel/runtime" --json' ) ;
51
- const jsonListedDependencies = JSON . parse ( listedBabelRuntime ) ;
52
- babelRuntimeVersion = jsonListedDependencies [ 0 ] . dependencies [ '@babel/runtime' ] . version ;
53
56
}
54
57
55
58
const babelConfigPath = path . resolve ( getWorkspaceRoot ( ) , 'babel.config.js' ) ;
You can’t perform that action at this time.
0 commit comments