@@ -232,7 +232,28 @@ type ExtraTool = {
232232 command ?: string ;
233233} ;
234234
235- function runCommand ( command : string , cwd : string ) {
235+ function runCommand ( command : string , cwd : string , packageManager : string ) {
236+ // Replace `npm create` with the equivalent command for the detected package manager
237+ if ( command . startsWith ( 'npm create ' ) ) {
238+ const createReplacements : Record < string , string > = {
239+ bun : 'bun create ' ,
240+ pnpm : 'pnpm create ' ,
241+ yarn : 'yarn create ' ,
242+ deno : 'deno run -A npm:create-' ,
243+ } ;
244+ const replacement = createReplacements [ packageManager ] ;
245+ if ( replacement ) {
246+ command = command
247+ . replace ( / ^ n p m c r e a t e / , replacement )
248+ // other package managers don't need the extra `--`
249+ . replace ( / - - - - / , ' --' ) ;
250+ }
251+ // Yarn v1 does not support `@latest` tag
252+ if ( packageManager === 'yarn' ) {
253+ command = command . replace ( '@latest' , '' ) ;
254+ }
255+ }
256+
236257 const [ bin , ...args ] = command . split ( ' ' ) ;
237258 spawn . sync ( bin , args , {
238259 stdio : 'inherit' ,
@@ -386,7 +407,7 @@ export async function create({
386407 } ) ;
387408 }
388409 if ( matchedTool . command ) {
389- runCommand ( matchedTool . command , distFolder ) ;
410+ runCommand ( matchedTool . command , distFolder , packageManager ) ;
390411 }
391412 continue ;
392413 }
0 commit comments