Skip to content

Commit 08623d5

Browse files
committed
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 angular#10250
1 parent 2b24391 commit 08623d5

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

packages/@angular/cli/models/command-runner.ts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,12 @@ export async function runCommand(commandMap: CommandMap,
129129
return await runHelp(command, options);
130130
} else {
131131
verifyCommandInScope(command, executionScope);
132-
if (!command.allowMissingWorkspace) {
133-
verifyWorkspace(command, executionScope, context.project.root);
134-
}
132+
verifyWorkspace(
133+
command,
134+
executionScope,
135+
context.project.root,
136+
command.allowMissingWorkspace ? logger : null,
137+
);
135138
delete options.h;
136139
delete options.help;
137140
return await validateAndRunCommand(command, options);
@@ -286,7 +289,12 @@ function verifyCommandInScope(command: Command, scope = CommandScope.everywhere)
286289
}
287290
}
288291

289-
function verifyWorkspace(command: Command, executionScope: CommandScope, root: string): void {
292+
function verifyWorkspace(
293+
command: Command,
294+
executionScope: CommandScope,
295+
root: string,
296+
logger: logging.Logger | null = null,
297+
): void {
290298
if (command.scope === CommandScope.everywhere) {
291299
return;
292300
}
@@ -312,12 +320,19 @@ function verifyWorkspace(command: Command, executionScope: CommandScope, root: s
312320
// ------------------------------------------------------------------------------------------
313321
// If changing this message, please update the same message in
314322
// `packages/@angular/cli/bin/ng-update-message.js`
315-
throw new SilentError(tags.stripIndent`
323+
const message = tags.stripIndent`
316324
The Angular CLI configuration format has been changed, and your existing configuration can
317325
be updated automatically by running the following command:
318326
319327
ng update @angular/cli --migrate-only --from=1
320-
`);
328+
`;
329+
330+
if (!logger) {
331+
throw new SilentError(message);
332+
} else {
333+
logger.warn(message);
334+
return;
335+
}
321336
}
322337

323338
// If no configuration file is found (old or new), throw an exception.

0 commit comments

Comments
 (0)