@nxrocks/common
Version:
Common library to share code among the `@nxrocks/*` plugins.
26 lines • 952 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateProjectConfigurationIf = updateProjectConfigurationIf;
exports.updateNxJsonIf = updateNxJsonIf;
const devkit_1 = require("@nx/devkit");
async function updateProjectConfigurationIf(tree, predicate, updater) {
const projects = (0, devkit_1.getProjects)(tree);
for (const [, project] of projects) {
if (!project || !predicate(project)) {
continue;
}
updater(project);
if (project.name)
(0, devkit_1.updateProjectConfiguration)(tree, project.name, project);
}
}
async function updateNxJsonIf(tree, predicate, updater) {
// update options from nx.json target defaults
const nxJson = (0, devkit_1.readNxJson)(tree);
if (!nxJson || !predicate(nxJson)) {
return;
}
updater(nxJson);
(0, devkit_1.updateNxJson)(tree, nxJson);
}
//# sourceMappingURL=migration-utils.js.map