UNPKG

1.02 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.moveProjectConfiguration = void 0;
4const devkit_1 = require("@nrwl/devkit");
5function moveProjectConfiguration(tree, schema, projectConfig) {
6 if (projectConfig.name) {
7 projectConfig.name = schema.newProjectName;
8 }
9 const isStandalone = (0, devkit_1.isStandaloneProject)(tree, schema.projectName);
10 const projectString = JSON.stringify(projectConfig);
11 const newProjectString = projectString.replace(new RegExp(projectConfig.root, 'g'), schema.relativeToRootDestination);
12 // rename
13 const newProject = JSON.parse(newProjectString);
14 // Delete the original project
15 (0, devkit_1.removeProjectConfiguration)(tree, schema.projectName);
16 // Create a new project with the root replaced
17 (0, devkit_1.addProjectConfiguration)(tree, schema.newProjectName, newProject, isStandalone);
18}
19exports.moveProjectConfiguration = moveProjectConfiguration;
20//# sourceMappingURL=move-project-configuration.js.map
\No newline at end of file