@@ -172,18 +172,35 @@ export async function createNew(command: Command) {
172172 }
173173 cp ( templatePath , targetPath )
174174
175- // Replace "replace-me" in all files
175+ // Replace "replace-me" and package manager placeholders in all files
176176 function replace ( dir : string ) {
177177 const entries = fs . readdirSync ( dir , { withFileTypes : true } )
178178
179+ // Determine pmx (package executor) based on package manager
180+ const pmx = packageManager === 'npm' ? 'npx'
181+ : packageManager === 'pnpm' ? 'pnpx'
182+ : packageManager === 'bun' ? 'bunx'
183+ : packageManager === 'yarn' ? 'yarn dlx'
184+ : 'npx'
185+
186+ // Determine setup step based on package manager
187+ let setupStep = ''
188+ if ( packageManager === 'pnpm' )
189+ setupStep = `\n - name: Set up pnpm\n uses: pnpm/action-setup@v4\n`
190+ else if ( packageManager === 'bun' )
191+ setupStep = `\n - name: Set up Bun\n uses: oven-sh/setup-bun@v2\n`
192+
179193 for ( const entry of entries ) {
180194 const fullPath = path . join ( dir , entry . name )
181195
182196 if ( entry . isDirectory ( ) ) replace ( fullPath )
183197 else
184198 try {
185199 const content = fs . readFileSync ( fullPath , 'utf-8' )
186- const updated = content . replace ( / r e p l a c e - m e / g, packageName as string )
200+ let updated = content . replace ( / r e p l a c e - m e / g, packageName as string )
201+ updated = updated . replace ( / \{ p m \} / g, packageManager )
202+ updated = updated . replace ( / \{ p m x \} / g, pmx )
203+ updated = updated . replace ( / \{ s e t u p S t e p \} / g, setupStep )
187204 if ( content !== updated ) fs . writeFileSync ( fullPath , updated , 'utf-8' )
188205 } catch { }
189206 }
0 commit comments