@@ -12,9 +12,10 @@ import { copyTemplates } from './functions/copyTemplates.js';
1212import { installDeps } from './functions/installDeps.js' ;
1313import { setup } from './functions/setup.js' ;
1414import type { Language , PackageManager } from './types' ;
15- import { textColors } from './utils.js' ;
15+ import { detectPackageManager , textColors } from './utils.js' ;
1616
1717const commandkitGradient = gradient ( textColors . commandkit ) ( 'CommandKit' ) ;
18+
1819intro ( `Welcome to ${ commandkitGradient } !` ) ;
1920
2021const dir = path . resolve (
@@ -41,12 +42,13 @@ const dir = path.resolve(
4142
4243const manager = ( await select ( {
4344 message : 'Select a package manager:' ,
44- initialValue : 'npm' as PackageManager ,
45+ initialValue : detectPackageManager ( ) ,
4546 options : [
4647 { label : 'npm' , value : 'npm' } ,
4748 { label : 'pnpm' , value : 'pnpm' } ,
4849 { label : 'yarn' , value : 'yarn' } ,
4950 { label : 'bun' , value : 'bun' } ,
51+ { label : 'deno' , value : 'deno' } ,
5052 ] ,
5153} ) ) as PackageManager ;
5254
@@ -98,13 +100,29 @@ installDeps({
98100 stdio : 'pipe' ,
99101} ) ;
100102
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+
101119console . log (
102120 `${ gradient ( textColors . commandkit ) ( 'Thank you for choosing CommandKit!' ) }
103121
104122To 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
108126
109127• Documentation: ${ colors . blue ( 'https://commandkit.dev' ) }
110128• GitHub: ${ colors . blue ( 'https://github.com/underctrl-io/commandkit' ) }
0 commit comments