@@ -556,7 +556,7 @@ export async function runAddonsApply({
556556 addonSetupResults ?: Record < string , AddonSetupResult > ;
557557 workspace : Workspace ;
558558 fromCommand : 'create' | 'add' ;
559- } ) : Promise < { nextSteps : string [ ] ; argsFormattedAddons : string [ ] } > {
559+ } ) : Promise < { nextSteps : string [ ] ; argsFormattedAddons : string [ ] ; filesToFormat : string [ ] } > {
560560 if ( ! addonSetupResults ) {
561561 const setups = selectedAddons . length
562562 ? selectedAddons . map ( ( { addon } ) => addon )
@@ -565,7 +565,8 @@ export async function runAddonsApply({
565565 }
566566 // we'll return early when no addons are selected,
567567 // indicating that installing deps was skipped and no PM was selected
568- if ( selectedAddons . length === 0 ) return { nextSteps : [ ] , argsFormattedAddons : [ ] } ;
568+ if ( selectedAddons . length === 0 )
569+ return { nextSteps : [ ] , argsFormattedAddons : [ ] , filesToFormat : [ ] } ;
569570
570571 // apply addons
571572 const officialDetails = Object . keys ( answersOfficial ) . map ( ( id ) => getAddonDetails ( id ) ) ;
@@ -662,19 +663,7 @@ export async function runAddonsApply({
662663 if ( packageManager ) {
663664 workspace . packageManager = packageManager ;
664665 await installDependencies ( packageManager , options . cwd ) ;
665- }
666-
667- // format modified/created files with prettier (if available)
668- if ( filesToFormat . length > 0 && packageManager && ! ! workspace . dependencyVersion ( 'prettier' ) ) {
669- const { start, stop } = p . spinner ( ) ;
670- start ( 'Formatting modified files' ) ;
671- try {
672- await formatFiles ( { packageManager, cwd : options . cwd , paths : filesToFormat } ) ;
673- stop ( 'Successfully formatted modified files' ) ;
674- } catch ( e ) {
675- stop ( 'Failed to format files' ) ;
676- if ( e instanceof Error ) p . log . error ( e . message ) ;
677- }
666+ await formatFiles ( { packageManager, cwd : options . cwd , filesToFormat } ) ;
678667 }
679668
680669 const highlighter = getHighlighter ( ) ;
@@ -693,7 +682,7 @@ export async function runAddonsApply({
693682 } )
694683 . filter ( ( msg ) => msg !== undefined ) ;
695684
696- return { nextSteps, argsFormattedAddons } ;
685+ return { nextSteps, argsFormattedAddons, filesToFormat } ;
697686}
698687
699688/**
0 commit comments