UNPKG

1.14 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.updateTsconfig = void 0;
4const devkit_1 = require("@nrwl/devkit");
5const path_1 = require("nx/src/utils/path");
6const typescript_1 = require("../../../utilities/typescript");
7/**
8 * Updates the tsconfig paths to remove the project.
9 *
10 * @param schema The options provided to the schematic
11 */
12function 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}
26exports.updateTsconfig = updateTsconfig;
27//# sourceMappingURL=update-tsconfig.js.map
\No newline at end of file