From a816abb3723a8524fa0513f48776103b040c4eb1 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Thu, 27 Feb 2025 08:59:12 +0100 Subject: [PATCH] build(copy-dist): use sync copying since this is a "standalone" script we are running and no other JS scritps are running "in the background", there's no real benefit for async here. --- bin/copy-dist.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/copy-dist.ts b/bin/copy-dist.ts index 4c69900cd..eb721e850 100644 --- a/bin/copy-dist.ts +++ b/bin/copy-dist.ts @@ -11,11 +11,11 @@ function log(...args: any[]) { } } -async function copyNodeModuleFileOrFolder(source: string) { +function copyNodeModuleFileOrFolder(source: string) { const destination = path.join(DEST_DIR, source); log(`Copying ${source} to ${destination}`); - await fs.ensureDir(path.dirname(destination)); - await fs.copy(source, destination); + fs.ensureDirSync(path.dirname(destination)); + fs.copySync(source, destination); } const copy = async () => { @@ -41,7 +41,7 @@ const copy = async () => { for (const asset of assetsToCopy) { log(`Copying ${asset}`); - await fs.copy(asset, path.join(DEST_DIR, asset)); + fs.copySync(asset, path.join(DEST_DIR, asset)); } /** @@ -50,7 +50,7 @@ const copy = async () => { const publicDirsToCopy = ["./src/public/app/doc_notes"]; const PUBLIC_DIR = path.join(DEST_DIR, "src", "public", "app-dist"); for (const dir of publicDirsToCopy) { - await fs.copy(dir, path.join(PUBLIC_DIR, path.basename(dir))); + fs.copySync(dir, path.join(PUBLIC_DIR, path.basename(dir))); } const nodeModulesFile = [ @@ -66,7 +66,7 @@ const copy = async () => { ]; for (const file of nodeModulesFile) { - await copyNodeModuleFileOrFolder(file); + copyNodeModuleFileOrFolder(file); } const nodeModulesFolder = [ @@ -99,7 +99,7 @@ const copy = async () => { ]; for (const folder of nodeModulesFolder) { - await copyNodeModuleFileOrFolder(folder); + copyNodeModuleFileOrFolder(folder); } };