mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 23:15:56 +08:00
fix(@angular/cli): show the ng update message even on ng update
All commands that allow a missing workspace will show the message if the angular workspace isnt up to date. It will not stop the process though. Fix #10250
This commit is contained in:
parent
2b24391722
commit
08623d5fe7
@ -129,9 +129,12 @@ export async function runCommand(commandMap: CommandMap,
|
||||
return await runHelp(command, options);
|
||||
} else {
|
||||
verifyCommandInScope(command, executionScope);
|
||||
if (!command.allowMissingWorkspace) {
|
||||
verifyWorkspace(command, executionScope, context.project.root);
|
||||
}
|
||||
verifyWorkspace(
|
||||
command,
|
||||
executionScope,
|
||||
context.project.root,
|
||||
command.allowMissingWorkspace ? logger : null,
|
||||
);
|
||||
delete options.h;
|
||||
delete options.help;
|
||||
return await validateAndRunCommand(command, options);
|
||||
@ -286,7 +289,12 @@ function verifyCommandInScope(command: Command, scope = CommandScope.everywhere)
|
||||
}
|
||||
}
|
||||
|
||||
function verifyWorkspace(command: Command, executionScope: CommandScope, root: string): void {
|
||||
function verifyWorkspace(
|
||||
command: Command,
|
||||
executionScope: CommandScope,
|
||||
root: string,
|
||||
logger: logging.Logger | null = null,
|
||||
): void {
|
||||
if (command.scope === CommandScope.everywhere) {
|
||||
return;
|
||||
}
|
||||
@ -312,12 +320,19 @@ function verifyWorkspace(command: Command, executionScope: CommandScope, root: s
|
||||
// ------------------------------------------------------------------------------------------
|
||||
// If changing this message, please update the same message in
|
||||
// `packages/@angular/cli/bin/ng-update-message.js`
|
||||
throw new SilentError(tags.stripIndent`
|
||||
const message = tags.stripIndent`
|
||||
The Angular CLI configuration format has been changed, and your existing configuration can
|
||||
be updated automatically by running the following command:
|
||||
|
||||
ng update @angular/cli --migrate-only --from=1
|
||||
`);
|
||||
`;
|
||||
|
||||
if (!logger) {
|
||||
throw new SilentError(message);
|
||||
} else {
|
||||
logger.warn(message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If no configuration file is found (old or new), throw an exception.
|
||||
|
Loading…
x
Reference in New Issue
Block a user