Skip to content

Commit

Permalink
Use non-blocking readFile
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoAndai committed Aug 8, 2024
1 parent 9f8c7ea commit e57388e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async function run(argv) {
NODE_ENV: 'production',
BABEL_ENV: bundle,
MUI_BUILD_VERBOSE: verbose,
...getVersionEnvVariables(),
...(await getVersionEnvVariables()),
};

const babelConfigPath = path.resolve(getWorkspaceRoot(), 'babel.config.js');
Expand Down
6 changes: 3 additions & 3 deletions scripts/utils.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import url from 'url';
import fs from 'fs';
import fs from 'fs/promises';

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

if (!version) {
Expand Down

0 comments on commit e57388e

Please sign in to comment.