@nx/angular
Version:
35 lines (34 loc) • 1.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const devkit_1 = require("@nx/devkit");
const executors = new Set([
'@nx/angular:ng-packagr-lite',
'@nrwl/angular:ng-packagr-lite',
'@nx/angular:package',
'@nrwl/angular:package',
]);
async function default_1(tree) {
// use project graph to get the expanded target configurations
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
for (const [projectName, { data: projectData }] of Object.entries(projectGraph.nodes)) {
if (projectData.projectType !== 'library') {
continue;
}
for (const [targetName, target] of Object.entries(projectData.targets || {})) {
if (!executors.has(target.executor)) {
continue;
}
if (!target.options ||
target.options.updateBuildableProjectDepsInPackageJson === undefined) {
// read the project configuration to write the explicit project configuration
// and avoid writing the expanded target configuration
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
project.targets[targetName].options ??= {};
project.targets[targetName].options.updateBuildableProjectDepsInPackageJson = true;
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
}
}
}
await (0, devkit_1.formatFiles)(tree);
}