@@ -129,9 +129,12 @@ export async function runCommand(commandMap: CommandMap,
129
129
return await runHelp ( command , options ) ;
130
130
} else {
131
131
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
+ ) ;
135
138
delete options . h ;
136
139
delete options . help ;
137
140
return await validateAndRunCommand ( command , options ) ;
@@ -286,7 +289,12 @@ function verifyCommandInScope(command: Command, scope = CommandScope.everywhere)
286
289
}
287
290
}
288
291
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 {
290
298
if ( command . scope === CommandScope . everywhere ) {
291
299
return ;
292
300
}
@@ -312,12 +320,19 @@ function verifyWorkspace(command: Command, executionScope: CommandScope, root: s
312
320
// ------------------------------------------------------------------------------------------
313
321
// If changing this message, please update the same message in
314
322
// `packages/@angular/cli/bin/ng-update-message.js`
315
- throw new SilentError ( tags . stripIndent `
323
+ const message = tags . stripIndent `
316
324
The Angular CLI configuration format has been changed, and your existing configuration can
317
325
be updated automatically by running the following command:
318
326
319
327
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
+ }
321
336
}
322
337
323
338
// If no configuration file is found (old or new), throw an exception.
0 commit comments