From 9d8d5cd5db46aac4f3b53e51948c3a5f050157c7 Mon Sep 17 00:00:00 2001 From: James Henry Date: Tue, 2 May 2023 15:22:22 +0400 Subject: [PATCH] fix(core): only modify angular.json on read when @nx/angular is present (#16693) (cherry picked from commit 32cbab7d26cc528f11cedc4caf48962f8583e449) --- packages/nx/src/adapter/ngcli-adapter.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/adapter/ngcli-adapter.ts b/packages/nx/src/adapter/ngcli-adapter.ts index e5576433262fd..24951869b83ef 100644 --- a/packages/nx/src/adapter/ngcli-adapter.ts +++ b/packages/nx/src/adapter/ngcli-adapter.ts @@ -353,7 +353,10 @@ export class NxScopedHost extends virtualFs.ScopedHost { } read(path: Path): Observable { - if (path === 'angular.json' || path === '/angular.json') { + if ( + (path === 'angular.json' || path === '/angular.json') && + isAngularPluginInstalled() + ) { return this.readMergedWorkspaceConfiguration().pipe( map((r) => Buffer.from(JSON.stringify(toOldFormat(r)))) ); @@ -566,7 +569,10 @@ export class NxScopeHostUsedForWrappedSchematics extends NxScopedHost { } read(path: Path): Observable { - if (path == 'angular.json' || path == '/angular.json') { + if ( + (path === 'angular.json' || path === '/angular.json') && + isAngularPluginInstalled() + ) { const projectJsonConfig = toOldFormat({ projects: Object.fromEntries(getProjects(this.host)), });