perf: don't use await inside loops (#6617)

This commit is contained in:
Zoltan Kochan
2023-06-05 12:12:47 +03:00
committed by GitHub
parent f870fa2af4
commit 4b97f1f07a
41 changed files with 326 additions and 264 deletions

View File

@@ -57,13 +57,13 @@ export async function handler (opts: PatchRemoveCommandOptions, params: string[]
throw new PnpmError('NO_PATCHES_TO_REMOVE', 'There are no patches that need to be removed')
}
for (const patch of patchesToRemove) {
await Promise.all(patchesToRemove.map(async (patch) => {
if (Object.prototype.hasOwnProperty.call(patchedDependencies, patch)) {
const patchFile = path.join(lockfileDir, patchedDependencies[patch])
await fs.rm(patchFile, { force: true })
delete rootProjectManifest.pnpm!.patchedDependencies![patch]
}
}
}))
await writeProjectManifest(rootProjectManifest)