File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -234,8 +234,19 @@ async function main(): Promise<void> {
234234 // Install dependencies
235235 console . log ( ) ;
236236 console . log ( colorize . bold `Installing dependencies...` ) ;
237- const installCommand = packageManager === "yarn" ? "yarn add" : `${ packageManager } install` ;
238- await shellNicelyFormatted ( `${ installCommand } ${ packagesToInstall . join ( ' ' ) } ` , {
237+ const installCommandMap = new Map < string , string > ( [
238+ [ "npm" , "npm install" ] ,
239+ [ "yarn" , "yarn add" ] ,
240+ [ "pnpm" , "pnpm add" ] ,
241+ [ "bun" , "bun add" ] ,
242+ ] ) ;
243+ const installCommand = installCommandMap . get ( packageManager ) ?? `${ packageManager } install` ;
244+ // Quote each package name to avoid shell interpretation of env-overridden values.
245+ const safePackages = packagesToInstall . map ( ( p ) => JSON . stringify ( p ) ) ;
246+ await shellNicelyFormatted ( `${ installCommand } ${ safePackages . join ( ' ' ) } ` , {
247+ shell : true ,
248+ cwd : projectPath ,
249+ } ) ;
239250 shell: true ,
240251 cwd : projectPath ,
241252 } ) ;
You can’t perform that action at this time.
0 commit comments