Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

Commit 91fc6b4

Browse files
committed
feat: make users choose their package manager manually
1 parent 0b3dea6 commit 91fc6b4

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

bin/bin.ts

+25-1
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,32 @@ program
227227
}
228228

229229
try {
230+
const installCommands = {
231+
npm: `npm install -D ${deps.join(' ')}`,
232+
yarn: `yarn add -D ${deps.join(' ')}`,
233+
pnpm: `pnpm add -D ${deps.join(' ')}`,
234+
bun: `bun add -D ${deps.join(' ')}`
235+
}
236+
237+
const { packageManager } = await inquirer.prompt<{
238+
packageManager: keyof typeof installCommands
239+
}>([
240+
{
241+
message: 'What is your package manager?',
242+
name: 'packageManager',
243+
default: 'npm',
244+
type: 'list',
245+
choices: [
246+
{ name: 'npm', value: 'npm' satisfies keyof typeof installCommands },
247+
{ name: 'yarn', value: 'yarn' satisfies keyof typeof installCommands },
248+
{ name: 'pnpm', value: 'pnpm' satisfies keyof typeof installCommands },
249+
{ name: 'bun', value: 'bun' satisfies keyof typeof installCommands }
250+
],
251+
}
252+
])
253+
230254
const execaRes = execaCommand(
231-
`npx --package=@antfu/ni ni --save-dev ${deps.join(' ')}`,
255+
installCommands[packageManager],
232256
{ env: { FORCE_COLOR: 'true' }, stdio: 'inherit' },
233257
)
234258

0 commit comments

Comments
 (0)