Skip to content

Commit ef33a9a

Browse files
committed
Use non-blocking readFile
1 parent 07d4f4a commit ef33a9a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

scripts/build.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function run(argv) {
3131
NODE_ENV: 'production',
3232
BABEL_ENV: bundle,
3333
MUI_BUILD_VERBOSE: verbose,
34-
...getVersionEnvVariables(),
34+
...(await getVersionEnvVariables()),
3535
};
3636

3737
const babelConfigPath = path.resolve(getWorkspaceRoot(), 'babel.config.js');

scripts/utils.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22
import url from 'url';
3-
import fs from 'fs';
3+
import fs from 'fs/promises';
44

55
/**
66
* Returns the full path of the root directory of this repository.
@@ -15,8 +15,8 @@ export function getWorkspaceRoot() {
1515
/**
1616
* Returns the version and destructured values of the version as env variables to be replaced.
1717
*/
18-
export function getVersionEnvVariables() {
19-
const packageJsonData = fs.readFileSync(path.resolve('./package.json'), 'utf8');
18+
export async function getVersionEnvVariables() {
19+
const packageJsonData = await fs.readFile(path.resolve('./package.json'), 'utf8');
2020
const { version = null } = JSON.parse(packageJsonData);
2121

2222
if (!version) {

0 commit comments

Comments
 (0)