Skip to content

Commit

Permalink
fix(core): outputs migration should handle no architect projects (#4217)
Browse files Browse the repository at this point in the history
Previously, if a project didn't contain an `architect` property it would fail.
  • Loading branch information
bekos committed Dec 7, 2020
1 parent 0a5ee20 commit c62e556
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/workspace/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
"factory": "./src/migrations/update-11-0-0/rename-workspace-schematics"
},
"add-outputs-in-workspace": {
"version": "11.0.0-beta.7",
"version": "11.0.0-beta.15",
"description": "Adds `outputs` based on builders",
"factory": "./src/migrations/update-11-0-0/add-outputs-in-workspace"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ describe('add `outputs` in workspace', () => {
},
},
},
noArchitect: {
projectType: 'library',
},
},
})
);
Expand All @@ -55,7 +58,7 @@ describe('add `outputs` in workspace', () => {
.toPromise();

const config = readWorkspace(tree);
const { products, cart } = config.projects;
const { products, cart, noArchitect } = config.projects;
expect(products.architect.build.outputs).toEqual([
'coverage/apps/products',
]);
Expand All @@ -65,5 +68,9 @@ describe('add `outputs` in workspace', () => {
expect(cart.architect.buildWithOutputsDefined.outputs).toEqual([
'test/dir',
]);

expect(noArchitect).toEqual({
projectType: 'library',
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { updateWorkspaceInTree } from '@nrwl/workspace';
const addOutputs = () =>
updateWorkspaceInTree((workspace) => {
for (const [, project] of Object.entries<any>(workspace.projects)) {
for (const [, target] of Object.entries<any>(project.architect)) {
for (const [, target] of Object.entries<any>(project.architect || {})) {
const builder = target?.builder;

if (!builder || target.outputs) {
Expand Down

0 comments on commit c62e556

Please sign in to comment.