From 6ce3424a9aa9152709b113ee233b831d7e42f317 Mon Sep 17 00:00:00 2001 From: Xiao Chuan Date: Sat, 20 May 2023 20:55:32 +0800 Subject: [PATCH] fix: lifecycle buildindex sort (#6568) --- .changeset/twelve-ears-thank.md | 6 ++++++ exec/lifecycle/src/runLifecycleHooksConcurrently.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/twelve-ears-thank.md diff --git a/.changeset/twelve-ears-thank.md b/.changeset/twelve-ears-thank.md new file mode 100644 index 00000000000..5a949301226 --- /dev/null +++ b/.changeset/twelve-ears-thank.md @@ -0,0 +1,6 @@ +--- +"@pnpm/lifecycle": patch +"pnpm": patch +--- + +Build projects in a workspace in correct order [#6568](https://github.com/pnpm/pnpm/pull/6568). diff --git a/exec/lifecycle/src/runLifecycleHooksConcurrently.ts b/exec/lifecycle/src/runLifecycleHooksConcurrently.ts index 740d2ac5695..eaa48ccb16e 100644 --- a/exec/lifecycle/src/runLifecycleHooksConcurrently.ts +++ b/exec/lifecycle/src/runLifecycleHooksConcurrently.ts @@ -38,7 +38,7 @@ export async function runLifecycleHooksConcurrently ( importersByBuildIndex.get(importer.buildIndex)!.push(importer) } } - const sortedBuildIndexes = Array.from(importersByBuildIndex.keys()).sort() + const sortedBuildIndexes = Array.from(importersByBuildIndex.keys()).sort((a, b) => a - b) const groups = sortedBuildIndexes.map((buildIndex) => { const importers = importersByBuildIndex.get(buildIndex)! return importers.map(({ manifest, modulesDir, rootDir, stages: importerStages, targetDirs }) =>