From f090a052c9dedc14a8701db2a636aa18b8babff4 Mon Sep 17 00:00:00 2001 From: Zhihao Cui <5257855+origami-z@users.noreply.github.com> Date: Sun, 3 Nov 2024 08:46:19 +0000 Subject: [PATCH] Use for await in install function (#1474) --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index bf7a7620..8a7a0c1c 100755 --- a/src/index.ts +++ b/src/index.ts @@ -144,7 +144,7 @@ const install = async ( const isWorkspace = options.workspaces || !!options.workspace?.length const pkgsNormalized = isWorkspace ? ['package.json'] : pkgs - pkgsNormalized.forEach(async pkgFile => { + for await (const pkgFile of pkgsNormalized) { const packageManager = await getPackageManagerForInstall(options, pkgFile) const cmd = packageManager + (process.platform === 'win32' ? '.cmd' : '') const cwd = options.cwd || path.resolve(pkgFile, '..') @@ -183,7 +183,7 @@ const install = async ( // if there is nothing on stderr, reject with stdout throw new Error(err?.message || err || stdout) } - }) + } } // show the install hint unless auto-install occurred else if (!isInteractive) {