cleanup(misc): formatter changes

This commit is contained in:
Jeremy Forsythe 2020-08-14 19:42:21 -04:00 committed by Jo Hanna Pearce
parent fb01c409bd
commit a4d0f11e73
2 changed files with 22 additions and 16 deletions

View File

@ -162,5 +162,4 @@ describe('updateWorkspace Rule', () => {
expect(workspace.defaultProject).toBeDefined(); expect(workspace.defaultProject).toBeDefined();
}); });
}); });
}); });

View File

@ -8,13 +8,20 @@ import { updateWorkspaceInTree, getWorkspacePath } from '@nrwl/workspace';
* @param schema The options provided to the schematic * @param schema The options provided to the schematic
*/ */
export function updateWorkspace(schema: Schema) { export function updateWorkspace(schema: Schema) {
return updateWorkspaceInTree((workspace, context: SchematicContext, host: Tree) => { return updateWorkspaceInTree(
delete workspace.projects[schema.projectName]; (workspace, context: SchematicContext, host: Tree) => {
if (workspace.defaultProject && workspace.defaultProject === schema.projectName) { delete workspace.projects[schema.projectName];
delete workspace.defaultProject; if (
const workspacePath = getWorkspacePath(host); workspace.defaultProject &&
context.logger.warn(`Default project was removed in ${workspacePath} because it was "${schema.projectName}". If you want a default project you should define a new one.`); workspace.defaultProject === schema.projectName
) {
delete workspace.defaultProject;
const workspacePath = getWorkspacePath(host);
context.logger.warn(
`Default project was removed in ${workspacePath} because it was "${schema.projectName}". If you want a default project you should define a new one.`
);
}
return workspace;
} }
return workspace; );
});
} }