@@ -66,38 +66,37 @@ async function runCommandsAndInstallDependencies(
66
66
environment : Environment ,
67
67
targetDir : string ,
68
68
options : Options ,
69
- silent : boolean ,
70
69
) {
71
- const s = silent ? null : environment . spinner ( )
70
+ const s = environment . spinner ( )
72
71
73
72
// Setup git
74
73
if ( options . git ) {
75
- s ? .start ( `Initializing git repository...` )
74
+ s . start ( `Initializing git repository...` )
76
75
await setupGit ( environment , targetDir )
77
- s ? .stop ( `Initialized git repository` )
76
+ s . stop ( `Initialized git repository` )
78
77
}
79
78
80
79
// Install dependencies
81
- s ? .start ( `Installing dependencies via ${ options . packageManager } ...` )
80
+ s . start ( `Installing dependencies via ${ options . packageManager } ...` )
82
81
await packageManagerInstall (
83
82
environment ,
84
83
resolve ( targetDir ) ,
85
84
options . packageManager ,
86
85
)
87
- s ? .stop ( `Installed dependencies` )
86
+ s . stop ( `Installed dependencies` )
88
87
89
88
for ( const phase of [ 'setup' , 'add-on' , 'example' ] ) {
90
89
for ( const addOn of options . chosenAddOns . filter (
91
90
( addOn ) =>
92
91
addOn . phase === phase && addOn . command && addOn . command . command ,
93
92
) ) {
94
- s ? .start ( `Setting up ${ addOn . name } ...` )
93
+ s . start ( `Setting up ${ addOn . name } ...` )
95
94
await environment . execute (
96
95
addOn . command ! . command ,
97
96
addOn . command ! . args || [ ] ,
98
97
resolve ( targetDir ) ,
99
98
)
100
- s ? .stop ( `${ addOn . name } setup complete` )
99
+ s . stop ( `${ addOn . name } setup complete` )
101
100
}
102
101
}
103
102
@@ -107,24 +106,19 @@ async function runCommandsAndInstallDependencies(
107
106
options . starter . command &&
108
107
options . starter . command . command
109
108
) {
110
- s ? .start ( `Setting up starter ${ options . starter . name } ...` )
109
+ s . start ( `Setting up starter ${ options . starter . name } ...` )
111
110
await environment . execute (
112
111
options . starter . command . command ,
113
112
options . starter . command . args || [ ] ,
114
113
resolve ( targetDir ) ,
115
114
)
116
- s ? .stop ( `Starter ${ options . starter . name } setup complete` )
115
+ s . stop ( `Starter ${ options . starter . name } setup complete` )
117
116
}
118
117
119
- await installShadcnComponents ( environment , targetDir , options , silent )
118
+ await installShadcnComponents ( environment , targetDir , options )
120
119
}
121
120
122
- function report (
123
- environment : Environment ,
124
- options : Options ,
125
- appName : string ,
126
- targetDir : string ,
127
- ) {
121
+ function report ( environment : Environment , options : Options , targetDir : string ) {
128
122
const warnings : Array < string > = [ ]
129
123
for ( const addOn of options . chosenAddOns ) {
130
124
if ( addOn . warning ) {
@@ -146,7 +140,7 @@ Errors were encountered during this process:
146
140
${ environment . getErrors ( ) . join ( '\n' ) } `
147
141
}
148
142
149
- environment . outro ( `Your ${ appName } app is ready in '${ basename ( targetDir ) } '.
143
+ environment . outro ( `Your ${ environment . appName } app is ready in '${ basename ( targetDir ) } '.
150
144
151
145
Use the following commands to start your app:
152
146
% cd ${ options . projectName }
@@ -158,36 +152,23 @@ Use the following commands to start your app:
158
152
}
159
153
160
154
export async function createApp (
155
+ environment : Environment ,
161
156
options : Options ,
162
157
{
163
- silent = false ,
164
- environment,
165
158
cwd,
166
- appName = 'TanStack' ,
167
159
} : {
168
- silent ?: boolean
169
- environment : Environment
170
160
cwd ?: string
171
- name ?: string
172
- appName ?: string
173
- } ,
161
+ } = { } ,
174
162
) {
175
163
environment . startRun ( )
176
164
177
165
const targetDir : string = cwd || resolve ( process . cwd ( ) , options . projectName )
178
166
179
167
await writeFiles ( environment , targetDir , options )
180
168
181
- await runCommandsAndInstallDependencies (
182
- environment ,
183
- targetDir ,
184
- options ,
185
- silent ,
186
- )
169
+ await runCommandsAndInstallDependencies ( environment , targetDir , options )
187
170
188
171
environment . finishRun ( )
189
172
190
- if ( ! silent ) {
191
- report ( environment , options , appName , targetDir )
192
- }
173
+ report ( environment , options , targetDir )
193
174
}
0 commit comments