diff --git a/packages/nx/src/adapter/angular-json.ts b/packages/nx/src/adapter/angular-json.ts index ac470a472fb9e..326a433bde100 100644 --- a/packages/nx/src/adapter/angular-json.ts +++ b/packages/nx/src/adapter/angular-json.ts @@ -40,15 +40,19 @@ export function isAngularPluginInstalled() { } } -function readAngularJson() { - return toNewFormat(readJsonFile(path.join(workspaceRoot, 'angular.json'))) - .projects; +function readAngularJson(angularCliWorkspaceRoot: string) { + return toNewFormat( + readJsonFile(path.join(angularCliWorkspaceRoot, 'angular.json')) + ).projects; } -export function mergeAngularJsonAndGlobProjects(globProjects: { - [name: string]: ProjectConfiguration; -}): { [name: string]: ProjectConfiguration } { - const res = readAngularJson(); +export function mergeAngularJsonAndGlobProjects( + globProjects: { + [name: string]: ProjectConfiguration; + }, + angularCliWorkspaceRoot: string +): { [name: string]: ProjectConfiguration } { + const res = readAngularJson(angularCliWorkspaceRoot); const folders = new Set(); for (let k of Object.keys(res)) { folders.add(res[k].root); diff --git a/packages/nx/src/config/workspaces.ts b/packages/nx/src/config/workspaces.ts index 804ea4028c33e..4dfd23142f99a 100644 --- a/packages/nx/src/config/workspaces.ts +++ b/packages/nx/src/config/workspaces.ts @@ -118,7 +118,8 @@ export class Workspaces { ) ) { projectsConfigurations.projects = mergeAngularJsonAndGlobProjects( - projectsConfigurations.projects + projectsConfigurations.projects, + this.root ); } this.cachedProjectsConfig = this.mergeTargetDefaultsIntoProjectDescriptions( diff --git a/packages/nx/src/executors/utils/convert-nx-executor.ts b/packages/nx/src/executors/utils/convert-nx-executor.ts index 061009dbf2dba..9bc808d894af4 100644 --- a/packages/nx/src/executors/utils/convert-nx-executor.ts +++ b/packages/nx/src/executors/utils/convert-nx-executor.ts @@ -22,12 +22,6 @@ export function convertNxExecutor(executor: Executor) { const projectsConfigurations = workspaces.readProjectsConfigurations(); const promise = async () => { - let projectGraph: ProjectGraph; - try { - projectGraph = readCachedProjectGraph(); - } catch { - projectGraph = await createProjectGraphAsync(); - } const nxJsonConfiguration = workspaces.readNxJson(); const context: ExecutorContext = { root: builderContext.workspaceRoot, @@ -39,7 +33,7 @@ export function convertNxExecutor(executor: Executor) { nxJsonConfiguration, workspace: { ...projectsConfigurations, ...nxJsonConfiguration }, cwd: process.cwd(), - projectGraph, + projectGraph: null, isVerbose: false, }; return executor(options, context);