fix(misc): @nrwl/workspace:rm generator should work with standalone configs (#6348)
* fix(devkit): removeProjectConfiguration should remove path for project.json from workspace.json When using standalone config files, removing a project's config should also remove its entry in the workspace file. * fix(misc): @nrwl/workspace:rm should work with standalone config files When using standalone config files, removing a project's config should also remove its entry in the workspace file.
This commit is contained in:
parent
4697ce1356
commit
84b40c8b85
@ -119,10 +119,11 @@ describe('project configuration', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should remove project.json file when removing projct configuration', () => {
|
||||
it('should remove project.json file when removing project configuration', () => {
|
||||
addProjectConfiguration(tree, 'test', baseTestProjectConfig, true);
|
||||
removeProjectConfiguration(tree, 'test');
|
||||
|
||||
expect(readJson(tree, 'workspace.json').projects.test).toBeUndefined();
|
||||
expect(tree.exists('test/project.json')).toBeFalsy();
|
||||
});
|
||||
|
||||
|
||||
@ -265,13 +265,12 @@ function addProjectToWorkspaceJson(
|
||||
if (configFile) {
|
||||
if (mode === 'delete') {
|
||||
host.delete(configFile);
|
||||
delete workspaceJson.projects[projectName];
|
||||
} else {
|
||||
writeJson(host, configFile, project);
|
||||
}
|
||||
|
||||
if (mode === 'create') {
|
||||
workspaceJson.projects[projectName] = project.root;
|
||||
writeJson(host, path, workspaceJson);
|
||||
}
|
||||
} else {
|
||||
let workspaceConfiguration: ProjectConfiguration;
|
||||
@ -279,10 +278,9 @@ function addProjectToWorkspaceJson(
|
||||
const { tags, implicitDependencies, ...c } = project;
|
||||
workspaceConfiguration = c;
|
||||
}
|
||||
|
||||
workspaceJson.projects[projectName] = workspaceConfiguration;
|
||||
writeJson(host, path, workspaceJson);
|
||||
}
|
||||
writeJson(host, path, workspaceJson);
|
||||
}
|
||||
|
||||
function addProjectToNxJson(
|
||||
|
||||
@ -18,8 +18,8 @@ export async function removeGenerator(tree: Tree, schema: Schema) {
|
||||
await checkDependencies(tree, schema);
|
||||
checkTargets(tree, schema, project);
|
||||
updateJestConfig(tree, schema, project);
|
||||
removeProject(tree, project);
|
||||
removeProjectConfig(tree, schema);
|
||||
removeProject(tree, project);
|
||||
updateTsconfig(tree, schema, project);
|
||||
if (!schema.skipFormat) {
|
||||
await formatFiles(tree);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user