From ef33a9aa75f11d6f2c28cc1d991175db9c50c105 Mon Sep 17 00:00:00 2001 From: DiegoAndai Date: Thu, 8 Aug 2024 14:39:06 -0400 Subject: [PATCH] Use non-blocking readFile --- scripts/build.mjs | 2 +- scripts/utils.mjs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/build.mjs b/scripts/build.mjs index fe9b815ed33df9..7a9cb3df939ae8 100644 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -31,7 +31,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'); diff --git a/scripts/utils.mjs b/scripts/utils.mjs index acf0e6e27a8c8e..4f0f37d49cf825 100644 --- a/scripts/utils.mjs +++ b/scripts/utils.mjs @@ -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. @@ -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) {