nx/packages/angular/src/migrations/update-18-2-0/update-angular-cli.ts
2024-03-19 14:58:23 -04:00

24 lines
598 B
TypeScript

import { formatFiles, Tree, updateJson } from '@nx/devkit';
export const angularCliVersion = '~17.3.0';
export default async function (tree: Tree) {
let shouldFormat = false;
updateJson(tree, 'package.json', (json) => {
if (json.devDependencies?.['@angular/cli']) {
json.devDependencies['@angular/cli'] = angularCliVersion;
shouldFormat = true;
} else if (json.dependencies?.['@angular/cli']) {
json.dependencies['@angular/cli'] = angularCliVersion;
shouldFormat = true;
}
return json;
});
if (shouldFormat) {
await formatFiles(tree);
}
}