refactor(dev-infra): use promptConfirm util in ng-dev's formatter (#38419)
Use the promptConfirm util instead of manually creating a confirm prompt with inquirer. PR Close #38419
This commit is contained in:
		
							parent
							
								
									823dd5b341
								
							
						
					
					
						commit
						aa3520eb7d
					
				| @ -10,12 +10,10 @@ ts_library( | |||||||
|     deps = [ |     deps = [ | ||||||
|         "//dev-infra/utils", |         "//dev-infra/utils", | ||||||
|         "@npm//@types/cli-progress", |         "@npm//@types/cli-progress", | ||||||
|         "@npm//@types/inquirer", |  | ||||||
|         "@npm//@types/node", |         "@npm//@types/node", | ||||||
|         "@npm//@types/shelljs", |         "@npm//@types/shelljs", | ||||||
|         "@npm//@types/yargs", |         "@npm//@types/yargs", | ||||||
|         "@npm//cli-progress", |         "@npm//cli-progress", | ||||||
|         "@npm//inquirer", |  | ||||||
|         "@npm//multimatch", |         "@npm//multimatch", | ||||||
|         "@npm//shelljs", |         "@npm//shelljs", | ||||||
|         "@npm//yargs", |         "@npm//yargs", | ||||||
|  | |||||||
| @ -6,9 +6,7 @@ | |||||||
|  * found in the LICENSE file at https://angular.io/license
 |  * found in the LICENSE file at https://angular.io/license
 | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| import {prompt} from 'inquirer'; | import {error, info, promptConfirm} from '../utils/console'; | ||||||
| 
 |  | ||||||
| import {error, info} from '../utils/console'; |  | ||||||
| 
 | 
 | ||||||
| import {runFormatterInParallel} from './run-commands-parallel'; | import {runFormatterInParallel} from './run-commands-parallel'; | ||||||
| 
 | 
 | ||||||
| @ -57,11 +55,7 @@ export async function checkFiles(files: string[]) { | |||||||
|     // If the command is run in a non-CI environment, prompt to format the files immediately.
 |     // If the command is run in a non-CI environment, prompt to format the files immediately.
 | ||||||
|     let runFormatter = false; |     let runFormatter = false; | ||||||
|     if (!process.env['CI']) { |     if (!process.env['CI']) { | ||||||
|       runFormatter = (await prompt({ |       runFormatter = await promptConfirm('Format the files now?', true); | ||||||
|                        type: 'confirm', |  | ||||||
|                        name: 'runFormatter', |  | ||||||
|                        message: 'Format the files now?', |  | ||||||
|                      })).runFormatter; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (runFormatter) { |     if (runFormatter) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user