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 }) =>