Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 1x 1x 1x 1x 1x 1x 1x 1x 15x 15x 15x 15x 15x 15x 15x 15x 15x 14x 14x 14x 1x 1x 1x 1x 1x 1x | import { type ProjectConfiguration, type Tree } from '@nx/devkit';
import { omit } from 'lodash-es';
import { assert } from '@amalia/ext/typescript';
import { updateProjectConfiguration } from '../../helpers/project-configuration';
export const removeBuildTargetFromLib = (tree: Tree, projectConfiguration: ProjectConfiguration) => {
const projectName = projectConfiguration.name;
assert(projectName, `Project name missing in ${projectConfiguration.root}`);
if (projectConfiguration.projectType !== 'library') {
// ignore non-library projects
return;
}
const buildTargetName = Object.keys(projectConfiguration.targets ?? {}).find((target) => target.includes('build'));
if (!buildTargetName) {
// Nothing to do.
return;
}
updateProjectConfiguration(tree, projectConfiguration.root, {
...projectConfiguration,
targets: omit(projectConfiguration.targets, buildTargetName),
});
};
|