File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change 1
1
import childProcess from 'child_process' ;
2
- import glob from 'fast-glob' ;
3
2
import path from 'path' ;
4
3
import { promisify } from 'util' ;
5
4
import yargs from 'yargs' ;
@@ -67,7 +66,7 @@ async function run(argv) {
67
66
MUI_BUILD_VERBOSE : verbose ,
68
67
MUI_BABEL_RUNTIME_VERSION : babelRuntimeVersion ,
69
68
MUI_OUT_FILE_EXTENSION : outFileExtension ,
70
- ...( await getVersionEnvVariables ( ) ) ,
69
+ ...( await getVersionEnvVariables ( packageJson ) ) ,
71
70
} ;
72
71
73
72
const babelArgs = [
Original file line number Diff line number Diff line change 1
1
import path from 'path' ;
2
2
import url from 'url' ;
3
- import fs from 'fs/promises' ;
4
3
5
4
/**
6
5
* Returns the full path of the root directory of this repository.
@@ -15,12 +14,10 @@ export function getWorkspaceRoot() {
15
14
/**
16
15
* Returns the version and destructured values of the version as env variables to be replaced.
17
16
*/
18
- export async function getVersionEnvVariables ( ) {
19
- const packageJsonData = await fs . readFile ( path . resolve ( './package.json' ) , 'utf8' ) ;
20
- const { version = null } = JSON . parse ( packageJsonData ) ;
21
-
17
+ export function getVersionEnvVariables ( pkgJson ) {
18
+ const version = pkgJson . version ;
22
19
if ( ! version ) {
23
- throw new Error ( 'Could not find the version in the package.json' ) ;
20
+ throw new Error ( 'No version found in package.json' ) ;
24
21
}
25
22
26
23
const [ versionNumber , prerelease ] = version . split ( '-' ) ;
You can’t perform that action at this time.
0 commit comments