@@ -38,38 +38,62 @@ async function writeFiles(environment: Environment, options: Options) {
38
38
}
39
39
}
40
40
41
- environment . startStep ( 'Writing framework files...' )
41
+ environment . startStep ( {
42
+ id : 'write-framework-files' ,
43
+ type : 'file' ,
44
+ message : 'Writing framework files...' ,
45
+ } )
42
46
await writeFileBundle ( options . framework )
43
- environment . finishStep ( 'Framework files written' )
47
+ environment . finishStep ( 'write-framework-files' , ' Framework files written')
44
48
49
+ let wroteAddonFiles = false
45
50
for ( const type of [ 'add-on' , 'example' , 'toolchain' ] ) {
46
51
for ( const phase of [ 'setup' , 'add-on' , 'example' ] ) {
47
52
for ( const addOn of options . chosenAddOns . filter (
48
53
( addOn ) => addOn . phase === phase && addOn . type === type ,
49
54
) ) {
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
+ } )
51
60
await writeFileBundle ( addOn )
52
- environment . finishStep ( ` ${ addOn . name } files written` )
61
+ wroteAddonFiles = true
53
62
}
54
63
}
55
64
}
65
+ if ( wroteAddonFiles ) {
66
+ environment . finishStep ( 'write-addon-files' , 'Add-on files written' )
67
+ }
56
68
57
69
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
+ } )
59
75
await writeFileBundle ( options . starter )
60
- environment . finishStep ( ` Starter files written` )
76
+ environment . finishStep ( 'write-starter-files' , ' Starter files written' )
61
77
}
62
78
63
- environment . startStep ( `Writing package.json...` )
79
+ environment . startStep ( {
80
+ id : 'write-package-json' ,
81
+ type : 'file' ,
82
+ message : 'Writing package.json...' ,
83
+ } )
64
84
await environment . writeFile (
65
85
resolve ( options . targetDir , './package.json' ) ,
66
86
JSON . stringify ( createPackageJSON ( options ) , null , 2 ) ,
67
87
)
68
- environment . finishStep ( ` package.json written` )
88
+ environment . finishStep ( 'write- package-json' , 'Package .json written' )
69
89
70
- environment . startStep ( `Writing config file...` )
90
+ environment . startStep ( {
91
+ id : 'write-config-file' ,
92
+ type : 'file' ,
93
+ message : 'Writing config file...' ,
94
+ } )
71
95
await writeConfigFileToEnvironment ( environment , options )
72
- environment . finishStep ( ` Config file written` )
96
+ environment . finishStep ( 'write-config-file' , ' Config file written' )
73
97
}
74
98
75
99
async function runCommandsAndInstallDependencies (
@@ -81,41 +105,58 @@ async function runCommandsAndInstallDependencies(
81
105
// Setup git
82
106
if ( options . git ) {
83
107
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
+ } )
85
113
86
114
await setupGit ( environment , options . targetDir )
87
115
88
- environment . finishStep ( `Initialized git repository` )
116
+ environment . finishStep (
117
+ 'initialize-git-repository' ,
118
+ 'Initialized git repository' ,
119
+ )
89
120
s . stop ( `Initialized git repository` )
90
121
}
91
122
92
123
// Install dependencies
93
124
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
+ } )
97
130
await packageManagerInstall (
98
131
environment ,
99
132
options . targetDir ,
100
133
options . packageManager ,
101
134
)
102
- environment . finishStep ( ` Installed dependencies` )
135
+ environment . finishStep ( 'install-dependencies' , ' Installed dependencies' )
103
136
s . stop ( `Installed dependencies` )
104
137
105
138
for ( const phase of [ 'setup' , 'add-on' , 'example' ] ) {
106
139
for ( const addOn of options . chosenAddOns . filter (
107
140
( addOn ) =>
108
141
addOn . phase === phase && addOn . command && addOn . command . command ,
109
142
) ) {
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
+ } )
112
153
await environment . execute (
113
154
addOn . command ! . command ,
114
155
addOn . command ! . args || [ ] ,
115
156
options . targetDir ,
116
157
)
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` )
119
160
}
120
161
}
121
162
@@ -126,16 +167,24 @@ async function runCommandsAndInstallDependencies(
126
167
options . starter . command . command
127
168
) {
128
169
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
+ } )
130
179
131
180
await environment . execute (
132
181
options . starter . command . command ,
133
182
options . starter . command . args || [ ] ,
134
183
options . targetDir ,
135
184
)
136
185
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` )
139
188
}
140
189
141
190
await installShadcnComponents ( environment , options . targetDir , options )
0 commit comments