Skip to content

Commit fd7bcd2

Browse files
hanslalexeagle
authored andcommitted
fix(@angular-devkit/core): use architect key only if it exists
And if target didnt exist.
1 parent 9517677 commit fd7bcd2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/angular_devkit/core/src/workspace/workspace.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export class Workspace {
6363

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

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

234235
// Try falling back to 'architect' if 'targets' is not there or is empty.
235-
if ((!workspaceTool || Object.keys(workspaceTool).length === 0) && toolName === 'targets') {
236+
if ((!workspaceTool || Object.keys(workspaceTool).length === 0)
237+
&& toolName === 'targets'
238+
&& this._workspace['architect']) {
236239
workspaceTool = this._workspace['architect'];
237240
}
238241

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

259262
// Try falling back to 'architect' if 'targets' is not there or is empty.
260-
if ((!projectTool || Object.keys(projectTool).length === 0) && toolName === 'targets') {
263+
if ((!projectTool || Object.keys(projectTool).length === 0)
264+
&& workspaceProject['architect']
265+
&& toolName === 'targets') {
261266
projectTool = workspaceProject['architect'];
262267
}
263268

264-
265269
if (!projectTool) {
266270
throw new ProjectToolNotFoundException(toolName);
267271
}

0 commit comments

Comments
 (0)