@@ -27,6 +27,26 @@ const argv = parse(process.argv.slice(2), {
27
27
} ,
28
28
} )
29
29
30
+ function agentInstall ( agent : string ) {
31
+ const commands = {
32
+ yarn : '' ,
33
+ npm : 'install' ,
34
+ pnpm : 'install' ,
35
+ deno : 'install' ,
36
+ } as const
37
+ return `${ agent } ${ commands [ agent ] ?? commands [ 'npm' ] } `
38
+ }
39
+
40
+ function agentRun ( agent : string , script : string ) {
41
+ const commands = {
42
+ 'yarn' : '' ,
43
+ 'npm' : ' run' ,
44
+ 'pnpm' : ' run' ,
45
+ 'deno' : ' task' ,
46
+ } as const
47
+ return `${ agent } ${ commands [ agent ] ?? commands [ 'npm' ] } ${ script } `
48
+ }
49
+
30
50
function supports ( command : string ) {
31
51
try {
32
52
execSync ( command , { stdio : 'ignore' } )
@@ -154,15 +174,15 @@ async function install() {
154
174
const yes = await confirm ( 'Install and start it now?' )
155
175
if ( yes ) {
156
176
execSync ( [ agent , 'install' ] . join ( ' ' ) , { stdio : 'inherit' , cwd : rootDir } )
157
- execSync ( [ agent , 'run' , 'start' ] . join ( ' ' ) , { stdio : 'inherit' , cwd : rootDir } )
177
+ execSync ( [ agent , agent === 'deno' ? 'task' : 'run' , 'start' ] . join ( ' ' ) , { stdio : 'inherit' , cwd : rootDir } )
158
178
} else {
159
179
console . log ( kleur . dim ( ' You can start it later by:\n' ) )
160
180
if ( rootDir !== cwd ) {
161
181
const related = relative ( cwd , rootDir )
162
182
console . log ( kleur . blue ( ` cd ${ kleur . bold ( related ) } ` ) )
163
183
}
164
- console . log ( kleur . blue ( ` ${ agent === 'yarn' ? 'yarn' : ` ${ agent } install` } ` ) )
165
- console . log ( kleur . blue ( ` ${ agent === 'yarn' ? 'yarn start' : ` ${ agent } run start` } ` ) )
184
+ console . log ( kleur . blue ( ` ${ agentInstall ( agent ) } ` ) )
185
+ console . log ( kleur . blue ( ` ${ agentRun ( agent , ' start') } ` ) )
166
186
console . log ( )
167
187
}
168
188
}
0 commit comments