@@ -41,7 +41,11 @@ import { parseJson } from '../utils/json';
41
41
import { NX_ERROR , NX_PREFIX } from '../utils/logger' ;
42
42
import { readModulePackageJson } from '../utils/package-json' ;
43
43
import { detectPackageManager } from '../utils/package-manager' ;
44
- import { toNewFormat , toOldFormat } from './angular-json' ;
44
+ import {
45
+ isAngularPluginInstalled ,
46
+ toNewFormat ,
47
+ toOldFormat ,
48
+ } from './angular-json' ;
45
49
import { normalizeExecutorSchema , Workspaces } from '../config/workspaces' ;
46
50
import {
47
51
CustomHasher ,
@@ -899,7 +903,8 @@ export function wrapAngularDevkitSchematic(
899
903
900
904
if ( event . kind === 'error' ) {
901
905
} else if ( event . kind === 'update' ) {
902
- if ( eventPath === 'angular.json' ) {
906
+ // Apply special handling for the angular.json file, but only when in an Nx workspace
907
+ if ( eventPath === 'angular.json' && isAngularPluginInstalled ( ) ) {
903
908
saveProjectsConfigurationsInWrappedSchematic (
904
909
host ,
905
910
event . content . toString ( )
@@ -1002,7 +1007,10 @@ function saveProjectsConfigurationsInWrappedSchematic(
1002
1007
? Object . keys ( existingAngularJson . projects )
1003
1008
: [ ] ;
1004
1009
1005
- const newAngularJson = { projects : { } } ;
1010
+ const newAngularJson = existingAngularJson || { } ;
1011
+
1012
+ // Reset projects in order to rebuild them, but leave other properties untouched
1013
+ newAngularJson . projects = { } ;
1006
1014
1007
1015
Object . keys ( projects ) . forEach ( ( projectName ) => {
1008
1016
if ( projectsInAngularJson . includes ( projectName ) ) {
1 commit comments
vercel[bot] commentedon Apr 27, 2023
Successfully deployed to the following URLs:
nx-dev – ./
nx-five.vercel.app
nx.dev
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app