From 57dc1053a8036332fd50af96b988e46dce5859b1 Mon Sep 17 00:00:00 2001 From: Artur Androsovych Date: Thu, 21 Sep 2023 23:19:00 +0300 Subject: [PATCH] chore(core): prepare Angular specific error only before throwing it (#18904) --- packages/nx/src/project-graph/project-graph.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/nx/src/project-graph/project-graph.ts b/packages/nx/src/project-graph/project-graph.ts index d0ba52be6c33a..a6b2c25a2cb30 100644 --- a/packages/nx/src/project-graph/project-graph.ts +++ b/packages/nx/src/project-graph/project-graph.ts @@ -21,14 +21,15 @@ import { readNxJson } from '../config/nx-json'; */ export function readCachedProjectGraph(): ProjectGraph { const projectGraphCache: ProjectGraph = readProjectGraphCache(); - const angularSpecificError = fileExists(`${workspaceRoot}/angular.json`) - ? stripIndents` + if (!projectGraphCache) { + const angularSpecificError = fileExists(`${workspaceRoot}/angular.json`) + ? stripIndents` Make sure invoke 'node ./decorate-angular-cli.js' in your postinstall script. The decorated CLI will compute the project graph. 'ng --help' should say 'Smart, Fast and Extensible Build System'. ` - : ''; - if (!projectGraphCache) { + : ''; + throw new Error(stripIndents` [readCachedProjectGraph] ERROR: No cached ProjectGraph is available.