From 0b086dd27c82f7f6e70dfad1109c9a44096fe2e0 Mon Sep 17 00:00:00 2001 From: --get Date: Tue, 2 Oct 2018 10:28:29 -0400 Subject: [PATCH] fix(schematics): fix affected for projects without architect config --- .../src/command-line/shared.spec.ts | 28 +++++++++++++++++++ .../schematics/src/command-line/shared.ts | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/packages/schematics/src/command-line/shared.spec.ts b/packages/schematics/src/command-line/shared.spec.ts index 732a47d106e81..3cf57d74c76ad 100644 --- a/packages/schematics/src/command-line/shared.spec.ts +++ b/packages/schematics/src/command-line/shared.spec.ts @@ -363,4 +363,32 @@ describe('getProjectNodes', () => { } ]); }); + + it('should normalize missing architect configurations to an empty object', () => { + const result = getProjectNodes(mockAngularJson, mockNxJson).map(node => { + return { name: node.name, architect: node.architect }; + }); + expect(result).toEqual([ + { + name: 'app1', + architect: {} + }, + { + name: 'app1-e2e', + architect: {} + }, + { + name: 'customName-e2e', + architect: {} + }, + { + name: 'lib1', + architect: {} + }, + { + name: 'lib2', + architect: {} + } + ]); + }); }); diff --git a/packages/schematics/src/command-line/shared.ts b/packages/schematics/src/command-line/shared.ts index 2b8c700f3d515..420db2c7a9e73 100644 --- a/packages/schematics/src/command-line/shared.ts +++ b/packages/schematics/src/command-line/shared.ts @@ -296,7 +296,7 @@ export function getProjectNodes(angularJson, nxJson): ProjectNode[] { root: p.root, type: projectType, tags, - architect: p.architect, + architect: p.architect || {}, files: allFilesInDir(`${appRoot.path}/${p.root}`), implicitDependencies };