@@ -12,9 +12,10 @@ import { copyTemplates } from './functions/copyTemplates.js';
12
12
import { installDeps } from './functions/installDeps.js' ;
13
13
import { setup } from './functions/setup.js' ;
14
14
import type { Language , PackageManager } from './types' ;
15
- import { textColors } from './utils.js' ;
15
+ import { detectPackageManager , textColors } from './utils.js' ;
16
16
17
17
const commandkitGradient = gradient ( textColors . commandkit ) ( 'CommandKit' ) ;
18
+
18
19
intro ( `Welcome to ${ commandkitGradient } !` ) ;
19
20
20
21
const dir = path . resolve (
@@ -41,12 +42,13 @@ const dir = path.resolve(
41
42
42
43
const manager = ( await select ( {
43
44
message : 'Select a package manager:' ,
44
- initialValue : 'npm' as PackageManager ,
45
+ initialValue : detectPackageManager ( ) ,
45
46
options : [
46
47
{ label : 'npm' , value : 'npm' } ,
47
48
{ label : 'pnpm' , value : 'pnpm' } ,
48
49
{ label : 'yarn' , value : 'yarn' } ,
49
50
{ label : 'bun' , value : 'bun' } ,
51
+ { label : 'deno' , value : 'deno' } ,
50
52
] ,
51
53
} ) ) as PackageManager ;
52
54
@@ -98,13 +100,29 @@ installDeps({
98
100
stdio : 'pipe' ,
99
101
} ) ;
100
102
103
+ const command = ( cmd : string ) => {
104
+ switch ( manager ) {
105
+ case 'npm' :
106
+ // bun build runs bundler instead of the build script
107
+ case 'bun' :
108
+ return `${ manager } run ${ cmd } ` ;
109
+ case 'pnpm' :
110
+ case 'yarn' :
111
+ return `${ manager } ${ cmd } ` ;
112
+ case 'deno' :
113
+ return `deno task ${ cmd } ` ;
114
+ default :
115
+ return manager satisfies never ;
116
+ }
117
+ } ;
118
+
101
119
console . log (
102
120
`${ gradient ( textColors . commandkit ) ( 'Thank you for choosing CommandKit!' ) }
103
121
104
122
To start your bot, use the following commands:
105
- ${ colors . magenta ( ` ${ manager } run dev` ) } - Run your bot in development mode
106
- ${ colors . magenta ( ` ${ manager } run build` ) } - Build your bot for production
107
- ${ colors . magenta ( ` ${ manager } run start` ) } - Run your bot in production mode
123
+ ${ colors . magenta ( command ( ' dev' ) ) } - Run your bot in development mode
124
+ ${ colors . magenta ( command ( ' build' ) ) } - Build your bot for production
125
+ ${ colors . magenta ( command ( ' start' ) ) } - Run your bot in production mode
108
126
109
127
• Documentation: ${ colors . blue ( 'https://commandkit.dev' ) }
110
128
• GitHub: ${ colors . blue ( 'https://github.com/underctrl-io/commandkit' ) }
0 commit comments