diff --git a/bun.lockb b/bun.lockb index 059c297..2bc8840 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 7d0f62b..ed3251f 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ }, "dependencies": { "commander": "12.0.0", + "inquirer": "9.2.20", "opener": "1.5.2" }, "devDependencies": { @@ -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", diff --git a/src/constants/package-mangers.ts b/src/constants/package-mangers.ts new file mode 100644 index 0000000..159306e --- /dev/null +++ b/src/constants/package-mangers.ts @@ -0,0 +1 @@ +export const PACKAGE_MANGERS = ['npm', 'yarn', 'pnpm', 'bun'] diff --git a/src/utils/package-managers.ts b/src/utils/package-managers.ts new file mode 100644 index 0000000..b423821 --- /dev/null +++ b/src/utils/package-managers.ts @@ -0,0 +1,21 @@ +// Constants +import { PACKAGE_MANGERS } from '@/constants/package-mangers' + +// Third-Party libraries +import inquirer from 'inquirer' + +export async function getPackageManger(): Promise { + 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.') + } +}