From ac9072dbcf601c08ae9af535aee30bd437fbf886 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Mon, 2 Dec 2024 16:42:43 -0500 Subject: [PATCH] fix(core): provide a way to reuse cached graph in CI --- packages/nx/src/project-graph/project-graph.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/nx/src/project-graph/project-graph.ts b/packages/nx/src/project-graph/project-graph.ts index eb1c101faee7b2..242a37169de27f 100644 --- a/packages/nx/src/project-graph/project-graph.ts +++ b/packages/nx/src/project-graph/project-graph.ts @@ -237,6 +237,13 @@ export async function createProjectGraphAsync( resetDaemonClient: false, } ): Promise { + if (process.env.NX_FORCE_REUSE_CACHED_GRAPH) { + try { + return readCachedProjectGraph(); + // If no cached graph is found, we will fall through to the normal flow + } catch {} + } + const projectGraphAndSourceMaps = await createProjectGraphAndSourceMapsAsync( opts );