Skip to content

Commit

Permalink
feat: implement package manager selection dropdown
Browse files Browse the repository at this point in the history
- Added a dropdown for users to select their preferred package manager.

ISSUES CLOSED: #10
  • Loading branch information
RaulCatalinas committed Apr 29, 2024
1 parent bd91587 commit ff176fe
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"dependencies": {
"commander": "12.0.0",
"inquirer": "9.2.20",
"opener": "1.5.2"
},
"devDependencies": {
Expand All @@ -22,6 +23,7 @@
"@swc/cli": "0.3.12",
"@swc/core": "1.4.17",
"@types/bun": "1.1.0",
"@types/inquirer": "9.0.7",
"@types/opener": "1.4.3",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"eslint": "^8.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/constants/package-mangers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const PACKAGE_MANGERS = ['npm', 'yarn', 'pnpm', 'bun']
21 changes: 21 additions & 0 deletions src/utils/package-managers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Constants
import { PACKAGE_MANGERS } from '@/constants/package-mangers'

// Third-Party libraries
import inquirer from 'inquirer'

export async function getPackageManger(): Promise<string> {
try {
const { packageManager } = await inquirer.prompt({
type: 'rawlist',
choices: PACKAGE_MANGERS,
message: 'Which package manager do you wanna use?',
name: 'packageManager'
})

return packageManager
} catch (error) {
console.error(error)
throw new Error('Something went wrong, try again later.')
}
}

0 comments on commit ff176fe

Please sign in to comment.