-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): keep decorate-cli script for existing workspace usages
- Loading branch information
1 parent
c8021f7
commit 14b517d
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from 'nx/src/adapter/decorate-cli'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { readFileSync, writeFileSync } from 'fs'; | ||
|
||
export function decorateCli() { | ||
console.warn( | ||
`Decoration of the Angular CLI is deprecated and will be removed in a future version.` | ||
); | ||
console.warn( | ||
`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); | ||
} |