1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.updateTsconfig = void 0;
|
4 | const devkit_1 = require("@nrwl/devkit");
|
5 | const path_1 = require("nx/src/utils/path");
|
6 | const typescript_1 = require("../../../utilities/typescript");
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | function updateTsconfig(tree, schema, project) {
|
13 | const { appsDir, libsDir, npmScope } = (0, devkit_1.getWorkspaceLayout)(tree);
|
14 | const tsConfigPath = (0, typescript_1.getRootTsConfigPathInTree)(tree);
|
15 | const defaultImportPath = (0, path_1.getImportPath)(npmScope, project.root
|
16 | .slice(project.projectType === 'application' ? appsDir.length : libsDir.length)
|
17 | .replace(/^\/|\\/, ''));
|
18 | const importPath = schema.importPath || defaultImportPath;
|
19 | if (tree.exists(tsConfigPath)) {
|
20 | (0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
|
21 | delete json.compilerOptions.paths[importPath];
|
22 | return json;
|
23 | });
|
24 | }
|
25 | }
|
26 | exports.updateTsconfig = updateTsconfig;
|
27 |
|
\ | No newline at end of file |