Skip to content

Commit

Permalink
fix(@angular-devkit/core): use architect key only if it exists
Browse files Browse the repository at this point in the history
And if target didnt exist.
  • Loading branch information
hansl authored and alexeagle committed Sep 6, 2018
1 parent 9517677 commit fd7bcd2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/angular_devkit/core/src/workspace/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class Workspace {

constructor(private _root: Path, private _host: virtualFs.Host<{}>) {
this._registry = new schema.CoreSchemaRegistry();
this._registry.addPostTransform(schema.transforms.addUndefinedDefaults);
}

loadWorkspaceFromJson(json: {}) {
Expand Down Expand Up @@ -232,7 +233,9 @@ export class Workspace {
let workspaceTool = this._workspace[toolName];

// Try falling back to 'architect' if 'targets' is not there or is empty.
if ((!workspaceTool || Object.keys(workspaceTool).length === 0) && toolName === 'targets') {
if ((!workspaceTool || Object.keys(workspaceTool).length === 0)
&& toolName === 'targets'
&& this._workspace['architect']) {
workspaceTool = this._workspace['architect'];
}

Expand All @@ -257,11 +260,12 @@ export class Workspace {
let projectTool = workspaceProject[toolName];

// Try falling back to 'architect' if 'targets' is not there or is empty.
if ((!projectTool || Object.keys(projectTool).length === 0) && toolName === 'targets') {
if ((!projectTool || Object.keys(projectTool).length === 0)
&& workspaceProject['architect']
&& toolName === 'targets') {
projectTool = workspaceProject['architect'];
}


if (!projectTool) {
throw new ProjectToolNotFoundException(toolName);
}
Expand Down

0 comments on commit fd7bcd2

Please sign in to comment.