diff --git a/.dependency-cruiser.json b/.dependency-cruiser.json index 2ed55f7f0..6173d7e22 100644 --- a/.dependency-cruiser.json +++ b/.dependency-cruiser.json @@ -41,7 +41,7 @@ "^node_modules", "^\\.yarn/cache", "^os$", - "^fs$", + "^fs(/promises)?$", "^path$", "^url$", "$1", diff --git a/src/cli/index.mjs b/src/cli/index.mjs index c2daec57b..46aad324f 100644 --- a/src/cli/index.mjs +++ b/src/cli/index.mjs @@ -118,14 +118,16 @@ async function runCruise(pFileDirectoryArray, pCruiseOptions) { setUpListener(lCruiseOptions); bus.emit("start"); + const [lResolveOptions, tsConfig, babelConfig] = await Promise.all([ + extractResolveOptions(lCruiseOptions), + extractTSConfigOptions(lCruiseOptions), + extractBabelConfigOptions(lCruiseOptions), + ]); const lReportingResult = await cruise( pFileDirectoryArray, lCruiseOptions, - await extractResolveOptions(lCruiseOptions), - { - tsConfig: await extractTSConfigOptions(lCruiseOptions), - babelConfig: await extractBabelConfigOptions(lCruiseOptions), - } + lResolveOptions, + { tsConfig, babelConfig } ); bus.emit("progress", "cli: writing results", { complete: 1 }); diff --git a/src/cli/tools/wrap-stream-in-html.mjs b/src/cli/tools/wrap-stream-in-html.mjs index d469ce7aa..cd1a200b7 100755 --- a/src/cli/tools/wrap-stream-in-html.mjs +++ b/src/cli/tools/wrap-stream-in-html.mjs @@ -1,4 +1,4 @@ -import { readFileSync } from "node:fs"; +import { readFile } from "node:fs/promises"; import { fileURLToPath } from "node:url"; const HEADER_FILE = fileURLToPath( @@ -25,10 +25,13 @@ const FOOTER_FILE = fileURLToPath( * @param {readStream} pStream stream whose characters are to be slapped between header and footer * @param {writeStream} pOutStream stream to write to */ -export default function wrap(pInStream, pOutStream) { - const lHeader = readFileSync(HEADER_FILE, "utf8"); - const lScript = readFileSync(SCRIPT_FILE, "utf8"); - const lEnd = readFileSync(FOOTER_FILE, "utf8"); +export default async function wrap(pInStream, pOutStream) { + const [lHeader, lScript, lEnd] = await Promise.all([ + readFile(HEADER_FILE, "utf8"), + readFile(SCRIPT_FILE, "utf8"), + readFile(FOOTER_FILE, "utf8"), + ]); + const lFooter = `${lEnd}`; pOutStream.write(lHeader);