File tree Expand file tree Collapse file tree 2 files changed +25
-12
lines changed
packages/create-commandkit/src Expand file tree Collapse file tree 2 files changed +25
-12
lines changed Original file line number Diff line number Diff line change @@ -132,9 +132,6 @@ Examples:
132132 process . exit ( 1 ) ;
133133 }
134134
135- // Determine package manager
136- const manager = resolvePackageManager ( cliOptions ) ;
137-
138135 // Get Discord token
139136 let token : string ;
140137 if ( cliOptions . yes ) {
@@ -158,9 +155,13 @@ Examples:
158155
159156 outro ( colors . cyan ( 'Setup complete.' ) ) ;
160157
158+ const example = cliOptions . example || getDefaultExample ( cliOptions ) ;
159+
160+ // Determine package manager
161+ const manager = resolvePackageManager ( cliOptions , example ) ;
162+
161163 // Fetch example from GitHub
162164 try {
163- const example = cliOptions . example || getDefaultExample ( cliOptions ) ;
164165 await fetchExample ( {
165166 example,
166167 examplePath : cliOptions . examplePath ,
Original file line number Diff line number Diff line change @@ -34,15 +34,18 @@ export function getPackageManagerFromCLI(options: {
3434 return null ;
3535}
3636
37- export function resolvePackageManager ( cliOptions : {
38- useNpm ?: boolean ;
39- usePnpm ?: boolean ;
40- useYarn ?: boolean ;
41- useBun ?: boolean ;
42- useDeno ?: boolean ;
43- } ) : PackageManager {
37+ export function resolvePackageManager (
38+ cliOptions : {
39+ useNpm ?: boolean ;
40+ usePnpm ?: boolean ;
41+ useYarn ?: boolean ;
42+ useBun ?: boolean ;
43+ useDeno ?: boolean ;
44+ } ,
45+ name : string ,
46+ ) : PackageManager {
4447 const cliManager = getPackageManagerFromCLI ( cliOptions ) ;
45- return cliManager || detectPackageManager ( ) ;
48+ return cliManager || ( isDenoProject ( name ) ? 'deno' : detectPackageManager ( ) ) ;
4649}
4750
4851export function getDefaultExample ( cliOptions : CLIOptions ) : string {
@@ -139,3 +142,12 @@ export async function fetchAvailableExamples(): Promise<string[]> {
139142 return [ 'basic-ts' , 'basic-js' , 'deno-ts' , 'without-cli' ] ;
140143 }
141144}
145+
146+ export function isDenoProject ( example : string ) : boolean {
147+ const isOfficial = isOfficialExample ( example ) ;
148+ // if it's not an official example, we can assume it's not a Deno project
149+ // the user may use --use-deno to force a Deno project
150+ if ( ! isOfficial ) return false ;
151+
152+ return example . startsWith ( 'deno-' ) || example . startsWith ( 'with-deno-' ) ;
153+ }
You can’t perform that action at this time.
0 commit comments