mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-21 22:34:21 +08:00
fix(@angular/cli): ng completion
inside of ng app folders warns but does not produce output
If an ng app was created with an older version of ng CLI, while the global ng CLI is more recent, one cannot perform ng completion INSIDE that app folder. This is due to the warning being written to stdout, which if appended to ~/.bashrc causes the shell to fail to process the English text as commands. The solution is to display the warning to stderr without producing the completion output. In good Unix style, a non-zero status code must returned. This PR fixes #6343. The PR introduces a breaking change: - the warning is written to stderr - - no output is produced - different status code returned
This commit is contained in:
parent
eb4dc223c3
commit
fff9b19ccb
@ -155,13 +155,21 @@ resolve('@angular/cli', { basedir: process.cwd() },
|
||||
}
|
||||
|
||||
if (shouldWarn && CliConfig.fromGlobal().get('warnings.versionMismatch')) {
|
||||
// eslint-disable no-console
|
||||
console.log(yellow(stripIndents`
|
||||
Your global Angular CLI version (${globalVersion}) is greater than your local
|
||||
version (${localVersion}). The local Angular CLI version is used.
|
||||
let warning = yellow(stripIndents`
|
||||
Your global Angular CLI version (${globalVersion}) is greater than your local
|
||||
version (${localVersion}). The local Angular CLI version is used.
|
||||
|
||||
To disable this warning use "ng set --global warnings.versionMismatch=false".
|
||||
`));
|
||||
To disable this warning use "ng set --global warnings.versionMismatch=false".
|
||||
`);
|
||||
// Don't show warning colorised on `ng completion`
|
||||
if (process.argv[2] !== 'completion') {
|
||||
// eslint-disable no-console
|
||||
console.log(warning);
|
||||
} else {
|
||||
// eslint-disable no-console
|
||||
console.error(warning);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// No error implies a projectLocalCli, which will load whatever
|
||||
|
Loading…
x
Reference in New Issue
Block a user