@@ -38,38 +38,62 @@ async function writeFiles(environment: Environment, options: Options) {
3838 }
3939 }
4040
41- environment . startStep ( 'Writing framework files...' )
41+ environment . startStep ( {
42+ id : 'write-framework-files' ,
43+ type : 'file' ,
44+ message : 'Writing framework files...' ,
45+ } )
4246 await writeFileBundle ( options . framework )
43- environment . finishStep ( 'Framework files written' )
47+ environment . finishStep ( 'write-framework-files' , ' Framework files written')
4448
49+ let wroteAddonFiles = false
4550 for ( const type of [ 'add-on' , 'example' , 'toolchain' ] ) {
4651 for ( const phase of [ 'setup' , 'add-on' , 'example' ] ) {
4752 for ( const addOn of options . chosenAddOns . filter (
4853 ( addOn ) => addOn . phase === phase && addOn . type === type ,
4954 ) ) {
50- environment . startStep ( `Writing ${ addOn . name } files...` )
55+ environment . startStep ( {
56+ id : 'write-addon-files' ,
57+ type : 'file' ,
58+ message : `Writing ${ addOn . name } files...` ,
59+ } )
5160 await writeFileBundle ( addOn )
52- environment . finishStep ( ` ${ addOn . name } files written` )
61+ wroteAddonFiles = true
5362 }
5463 }
5564 }
65+ if ( wroteAddonFiles ) {
66+ environment . finishStep ( 'write-addon-files' , 'Add-on files written' )
67+ }
5668
5769 if ( options . starter ) {
58- environment . startStep ( `Writing starter files...` )
70+ environment . startStep ( {
71+ id : 'write-starter-files' ,
72+ type : 'file' ,
73+ message : 'Writing starter files...' ,
74+ } )
5975 await writeFileBundle ( options . starter )
60- environment . finishStep ( ` Starter files written` )
76+ environment . finishStep ( 'write-starter-files' , ' Starter files written' )
6177 }
6278
63- environment . startStep ( `Writing package.json...` )
79+ environment . startStep ( {
80+ id : 'write-package-json' ,
81+ type : 'file' ,
82+ message : 'Writing package.json...' ,
83+ } )
6484 await environment . writeFile (
6585 resolve ( options . targetDir , './package.json' ) ,
6686 JSON . stringify ( createPackageJSON ( options ) , null , 2 ) ,
6787 )
68- environment . finishStep ( ` package.json written` )
88+ environment . finishStep ( 'write- package-json' , 'Package .json written' )
6989
70- environment . startStep ( `Writing config file...` )
90+ environment . startStep ( {
91+ id : 'write-config-file' ,
92+ type : 'file' ,
93+ message : 'Writing config file...' ,
94+ } )
7195 await writeConfigFileToEnvironment ( environment , options )
72- environment . finishStep ( ` Config file written` )
96+ environment . finishStep ( 'write-config-file' , ' Config file written' )
7397}
7498
7599async function runCommandsAndInstallDependencies (
@@ -81,41 +105,58 @@ async function runCommandsAndInstallDependencies(
81105 // Setup git
82106 if ( options . git ) {
83107 s . start ( `Initializing git repository...` )
84- environment . startStep ( `Initializing git repository...` )
108+ environment . startStep ( {
109+ id : 'initialize-git-repository' ,
110+ type : 'command' ,
111+ message : 'Initializing git repository...' ,
112+ } )
85113
86114 await setupGit ( environment , options . targetDir )
87115
88- environment . finishStep ( `Initialized git repository` )
116+ environment . finishStep (
117+ 'initialize-git-repository' ,
118+ 'Initialized git repository' ,
119+ )
89120 s . stop ( `Initialized git repository` )
90121 }
91122
92123 // Install dependencies
93124 s . start ( `Installing dependencies via ${ options . packageManager } ...` )
94- environment . startStep (
95- `Installing dependencies via ${ options . packageManager } ...` ,
96- )
125+ environment . startStep ( {
126+ id : 'install-dependencies' ,
127+ type : 'package-manager' ,
128+ message : `Installing dependencies via ${ options . packageManager } ...` ,
129+ } )
97130 await packageManagerInstall (
98131 environment ,
99132 options . targetDir ,
100133 options . packageManager ,
101134 )
102- environment . finishStep ( ` Installed dependencies` )
135+ environment . finishStep ( 'install-dependencies' , ' Installed dependencies' )
103136 s . stop ( `Installed dependencies` )
104137
105138 for ( const phase of [ 'setup' , 'add-on' , 'example' ] ) {
106139 for ( const addOn of options . chosenAddOns . filter (
107140 ( addOn ) =>
108141 addOn . phase === phase && addOn . command && addOn . command . command ,
109142 ) ) {
110- s . start ( `Setting up ${ addOn . name } ...` )
111- environment . startStep ( `Setting up ${ addOn . name } ...` )
143+ s . start ( `Running commands for ${ addOn . name } ...` )
144+ const cmd = formatCommand ( {
145+ command : addOn . command ! . command ,
146+ args : addOn . command ! . args || [ ] ,
147+ } )
148+ environment . startStep ( {
149+ id : 'run-commands' ,
150+ type : 'command' ,
151+ message : cmd ,
152+ } )
112153 await environment . execute (
113154 addOn . command ! . command ,
114155 addOn . command ! . args || [ ] ,
115156 options . targetDir ,
116157 )
117- environment . finishStep ( ` ${ addOn . name } setup complete` )
118- s . stop ( `${ addOn . name } setup complete` )
158+ environment . finishStep ( 'run-commands' , 'Setup commands complete' )
159+ s . stop ( `${ addOn . name } commands complete` )
119160 }
120161 }
121162
@@ -126,16 +167,24 @@ async function runCommandsAndInstallDependencies(
126167 options . starter . command . command
127168 ) {
128169 s . start ( `Setting up starter ${ options . starter . name } ...` )
129- environment . startStep ( `Setting up starter ${ options . starter . name } ...` )
170+ const cmd = formatCommand ( {
171+ command : options . starter . command . command ,
172+ args : options . starter . command . args || [ ] ,
173+ } )
174+ environment . startStep ( {
175+ id : 'run-starter-command' ,
176+ type : 'command' ,
177+ message : cmd ,
178+ } )
130179
131180 await environment . execute (
132181 options . starter . command . command ,
133182 options . starter . command . args || [ ] ,
134183 options . targetDir ,
135184 )
136185
137- environment . finishStep ( `Starter ${ options . starter . name } setup complete` )
138- s . stop ( `Starter ${ options . starter . name } setup complete` )
186+ environment . finishStep ( 'run- starter-command' , 'Starter command complete' )
187+ s . stop ( `${ options . starter . name } commands complete` )
139188 }
140189
141190 await installShadcnComponents ( environment , options . targetDir , options )
0 commit comments