1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.updateTsconfig = void 0;
|
4 | const tslib_1 = require("tslib");
|
5 | const devkit_1 = require("@nrwl/devkit");
|
6 | const ts_config_1 = require("../../../utilities/ts-config");
|
7 | const find_project_for_path_1 = require("nx/src/project-graph/utils/find-project-for-path");
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | function updateTsconfig(tree, schema) {
|
14 | return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
15 | const tsConfigPath = (0, ts_config_1.getRootTsConfigPathInTree)(tree);
|
16 | if (tree.exists(tsConfigPath)) {
|
17 | const graph = yield (0, devkit_1.createProjectGraphAsync)();
|
18 | const projectMapping = (0, find_project_for_path_1.createProjectRootMappings)(graph.nodes);
|
19 | (0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
|
20 | for (const importPath in json.compilerOptions.paths) {
|
21 | for (const path of json.compilerOptions.paths[importPath]) {
|
22 | const project = (0, find_project_for_path_1.findProjectForPath)((0, devkit_1.normalizePath)(path), projectMapping);
|
23 | if (project === schema.projectName) {
|
24 | delete json.compilerOptions.paths[importPath];
|
25 | break;
|
26 | }
|
27 | }
|
28 | }
|
29 | return json;
|
30 | });
|
31 | }
|
32 | });
|
33 | }
|
34 | exports.updateTsconfig = updateTsconfig;
|
35 |
|
\ | No newline at end of file |