Skip to content

Commit 9ae3c50

Browse files
authored
feat: add support for dependency installation with bun (#33)
1 parent 400ac6f commit 9ae3c50

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async function useSpinner(startMessage, fn, finishMessage) {
114114

115115
/**
116116
* @typedef {Object} ConfigOptions
117-
* @property {'yarn' | 'pnpm' | 'npm'} packageManager
117+
* @property {'yarn' | 'pnpm' | 'npm' | 'bun'} packageManager
118118
* @property {boolean} useTS
119119
* @property {boolean} useRouter
120120
* @property {boolean} usePrerender
@@ -235,7 +235,7 @@ async function installDeps(to, opts) {
235235

236236
/**
237237
* @param {string[]} pkgs
238-
* @param {{ packageManager: 'yarn' | 'pnpm' | 'npm', to: string, dev?: boolean }} opts
238+
* @param {{ packageManager: 'yarn' | 'pnpm' | 'npm' | 'bun', to: string, dev?: boolean }} opts
239239
*/
240240
function installPackages(pkgs, opts) {
241241
return x(
@@ -256,11 +256,12 @@ function installPackages(pkgs, opts) {
256256
}
257257

258258
/**
259-
* @returns {'yarn' | 'pnpm' | 'npm'}
259+
* @returns {'yarn' | 'pnpm' | 'npm' | 'bun'}
260260
*/
261261
function getPkgManager() {
262262
const userAgent = process.env.npm_config_user_agent || '';
263263
if (userAgent.startsWith('yarn')) return 'yarn';
264264
if (userAgent.startsWith('pnpm')) return 'pnpm';
265+
if (!!process.versions.bun) return 'bun';
265266
return 'npm';
266267
}

0 commit comments

Comments
 (0)