From 9061a9d8f11d724d50aed446e8a59ab48ad2a5f9 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Tue, 31 Oct 2023 20:44:48 -0400 Subject: [PATCH] fix(core): sort implicit dependencies before hashing --- .../nx/src/project-graph/utils/normalize-project-nodes.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nx/src/project-graph/utils/normalize-project-nodes.ts b/packages/nx/src/project-graph/utils/normalize-project-nodes.ts index 1d731d497803b..187f2a0ccb31e 100644 --- a/packages/nx/src/project-graph/utils/normalize-project-nodes.ts +++ b/packages/nx/src/project-graph/utils/normalize-project-nodes.ts @@ -23,7 +23,10 @@ export async function normalizeProjectNodes( nxJson: NxJsonConfiguration ) { const toAdd = []; - const projects = Object.keys(ctx.projects); + // Sorting projects by name to make sure that the order of projects in the graph is deterministic. + // This is important to ensure that expanded properties referencing projects (e.g. implicit dependencies) + // are also deterministic, and thus don't cause the calculated project configuration hash to shift. + const projects = Object.keys(ctx.projects).sort(); // Used for expanding implicit dependencies (e.g. `@proj/*` or `tag:foo`) const partialProjectGraphNodes = projects.reduce((graph, project) => {