@@ -99,7 +99,7 @@ export async function runAddCommand(
99
99
options : Options ,
100
100
selectedAddonIds : string [ ]
101
101
) : Promise < { nextSteps ?: string ; packageManager ?: AgentName | null } > {
102
- console . log ( 'run add command' ) ;
102
+ console . log ( 'run add command 2 ' ) ;
103
103
104
104
const selectedAddons : SelectedAddon [ ] = selectedAddonIds . map ( ( id ) => ( {
105
105
type : 'official' ,
@@ -341,31 +341,37 @@ export async function runAddCommand(
341
341
342
342
// run precondition checks
343
343
if ( options . preconditions && selectedAddons . length > 0 ) {
344
- // add global checks
345
- const addons = selectedAddons . map ( ( { addon } ) => addon ) ;
346
- const { preconditions } = getGlobalPreconditions ( options . cwd , addons , addonSetupResults ) ;
347
-
348
- const fails : Array < { name : string ; message ?: string } > = [ ] ;
349
- for ( const condition of preconditions ) {
350
- const { message, success } = await condition . run ( ) ;
351
- if ( ! success ) fails . push ( { name : condition . name , message } ) ;
352
- }
344
+ try {
345
+ console . log ( 'precondition checks' ) ;
346
+ // add global checks
347
+ const addons = selectedAddons . map ( ( { addon } ) => addon ) ;
348
+ const { preconditions } = getGlobalPreconditions ( options . cwd , addons , addonSetupResults ) ;
349
+ console . log ( preconditions ) ;
350
+
351
+ const fails : Array < { name : string ; message ?: string } > = [ ] ;
352
+ for ( const condition of preconditions ) {
353
+ const { message, success } = await condition . run ( ) ;
354
+ if ( ! success ) fails . push ( { name : condition . name , message } ) ;
355
+ }
353
356
354
- if ( fails . length > 0 ) {
355
- const message = fails
356
- . map ( ( { name, message } ) => pc . yellow ( `${ name } (${ message } )` ) )
357
- . join ( '\n- ' ) ;
357
+ if ( fails . length > 0 ) {
358
+ const message = fails
359
+ . map ( ( { name, message } ) => pc . yellow ( `${ name } (${ message } )` ) )
360
+ . join ( '\n- ' ) ;
358
361
359
- p . note ( `- ${ message } ` , 'Preconditions not met' ) ;
362
+ p . note ( `- ${ message } ` , 'Preconditions not met' ) ;
360
363
361
- const force = await p . confirm ( {
362
- message : 'Preconditions failed. Do you wish to continue?' ,
363
- initialValue : false
364
- } ) ;
365
- if ( p . isCancel ( force ) || ! force ) {
366
- p . cancel ( 'Operation cancelled.' ) ;
367
- process . exit ( 1 ) ;
364
+ const force = await p . confirm ( {
365
+ message : 'Preconditions failed. Do you wish to continue?' ,
366
+ initialValue : false
367
+ } ) ;
368
+ if ( p . isCancel ( force ) || ! force ) {
369
+ p . cancel ( 'Operation cancelled.' ) ;
370
+ process . exit ( 1 ) ;
371
+ }
368
372
}
373
+ } catch ( error ) {
374
+ console . log ( 'Error' , error ) ;
369
375
}
370
376
}
371
377
0 commit comments