fix(angular): keep decorate-cli script for existing workspace usages (#14266)
Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
This commit is contained in:
parent
0636fe7c3b
commit
b7a134baf6
1
packages/cli/lib/decorate-cli.ts
Normal file
1
packages/cli/lib/decorate-cli.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from 'nx/src/adapter/decorate-cli';
|
||||||
23
packages/nx/src/adapter/decorate-cli.ts
Normal file
23
packages/nx/src/adapter/decorate-cli.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { readFileSync, writeFileSync } from 'fs';
|
||||||
|
import { output } from '../utils/output';
|
||||||
|
|
||||||
|
export function decorateCli() {
|
||||||
|
output.warn({
|
||||||
|
title: `Decoration of the Angular CLI is deprecated and will be removed in a future version`,
|
||||||
|
bodyLines: [
|
||||||
|
`Please replace usage of "ng <command>" in any scripts, particularly for CI, with "nx <command>"`,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
const path = 'node_modules/@angular/cli/lib/cli/index.js';
|
||||||
|
const angularCLIInit = readFileSync(path, 'utf-8');
|
||||||
|
const start = angularCLIInit.indexOf(`(options) {`) + 11;
|
||||||
|
|
||||||
|
const newContent = `${angularCLIInit.slice(0, start)}
|
||||||
|
if (!process.env['NX_CLI_SET']) {
|
||||||
|
require('nx/bin/nx');
|
||||||
|
return new Promise(function(res, rej) {});
|
||||||
|
}
|
||||||
|
${angularCLIInit.substring(start)}
|
||||||
|
`;
|
||||||
|
writeFileSync(path, newContent);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user