@nx/angular
Version:
26 lines (25 loc) • 1.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateTsConfigIncludedFiles = updateTsConfigIncludedFiles;
const devkit_1 = require("@nx/devkit");
function updateTsConfigIncludedFiles(tree, options) {
const candidateTsConfigPaths = [
options.libraryProject.targets?.build?.options?.tsConfig,
(0, devkit_1.joinPathFragments)(options.libraryProject.root, 'tsconfig.lib.json'),
(0, devkit_1.joinPathFragments)(options.libraryProject.root, 'tsconfig.json'),
];
const tsConfigPath = candidateTsConfigPaths.find((path) => path && tree.exists(path));
if (!tsConfigPath) {
// ignore if the library has a custom tsconfig setup
return;
}
(0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
if (json.include?.length) {
json.include = json.include.map((path) => path.replace(/^(?:\.\/)?src\//, ''));
}
if (json.exclude?.length) {
json.exclude = json.exclude.map((path) => path.replace(/^(?:\.\/)?src\//, ''));
}
return json;
});
}