cleanup(misc): formatter changes
This commit is contained in:
parent
fb01c409bd
commit
a4d0f11e73
@ -66,9 +66,9 @@ describe('updateWorkspace Rule', () => {
|
||||
it('should delete the project', async () => {
|
||||
let workspace = JSON.parse(tree.read('workspace.json').toString());
|
||||
expect(workspace.projects['ng-app']).toBeDefined();
|
||||
|
||||
|
||||
tree = (await callRule(updateWorkspace(schema), tree)) as UnitTestTree;
|
||||
|
||||
|
||||
workspace = JSON.parse(tree.read('workspace.json').toString());
|
||||
expect(workspace.projects['ng-app']).toBeUndefined();
|
||||
});
|
||||
@ -136,12 +136,12 @@ describe('updateWorkspace Rule', () => {
|
||||
skipFormat: false,
|
||||
forceRemove: false,
|
||||
};
|
||||
|
||||
|
||||
let workspace = JSON.parse(tree.read('workspace.json').toString());
|
||||
expect(workspace.defaultProject).toBeDefined();
|
||||
|
||||
|
||||
tree = (await callRule(updateWorkspace(schema), tree)) as UnitTestTree;
|
||||
|
||||
|
||||
workspace = JSON.parse(tree.read('workspace.json').toString());
|
||||
expect(workspace.defaultProject).toBeUndefined();
|
||||
});
|
||||
@ -155,12 +155,11 @@ describe('updateWorkspace Rule', () => {
|
||||
|
||||
let workspace = JSON.parse(tree.read('workspace.json').toString());
|
||||
expect(workspace.defaultProject).toBeDefined();
|
||||
|
||||
|
||||
tree = (await callRule(updateWorkspace(schema), tree)) as UnitTestTree;
|
||||
|
||||
|
||||
workspace = JSON.parse(tree.read('workspace.json').toString());
|
||||
expect(workspace.defaultProject).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -8,13 +8,20 @@ import { updateWorkspaceInTree, getWorkspacePath } from '@nrwl/workspace';
|
||||
* @param schema The options provided to the schematic
|
||||
*/
|
||||
export function updateWorkspace(schema: Schema) {
|
||||
return updateWorkspaceInTree((workspace, context: SchematicContext, host: Tree) => {
|
||||
delete workspace.projects[schema.projectName];
|
||||
if (workspace.defaultProject && 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 updateWorkspaceInTree(
|
||||
(workspace, context: SchematicContext, host: Tree) => {
|
||||
delete workspace.projects[schema.projectName];
|
||||
if (
|
||||
workspace.defaultProject &&
|
||||
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;
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user