Skip to content

Commit

Permalink
feat: adapter-auto support bun add (#12854)
Browse files Browse the repository at this point in the history
* adapter-auto and bun

* changeset

* Update .changeset/serious-geckos-itch.md

Co-authored-by: Tee Ming <chewteeming01@gmail.com>

---------

Co-authored-by: Tee Ming <chewteeming01@gmail.com>
  • Loading branch information
RiskyMH and eltigerchino authored Oct 22, 2024
1 parent 0ab1733 commit 6671fa1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/serious-geckos-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-auto': minor
---

feat: add support for Bun package manager
4 changes: 3 additions & 1 deletion packages/adapter-auto/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import process from 'node:process';
const commands = {
npm: (name, version) => `npm install -D ${name}@${version}`,
pnpm: (name, version) => `pnpm add -D ${name}@${version}`,
yarn: (name, version) => `yarn add -D ${name}@${version}`
yarn: (name, version) => `yarn add -D ${name}@${version}`,
bun: (name, version) => `bun add -D ${name}@${version}`
};

function detect_lockfile() {
Expand All @@ -20,6 +21,7 @@ function detect_lockfile() {
if (existsSync(join(dir, 'pnpm-lock.yaml'))) return 'pnpm';
if (existsSync(join(dir, 'yarn.lock'))) return 'yarn';
if (existsSync(join(dir, 'package-lock.json'))) return 'npm';
if (existsSync(join(dir, 'bun.lockb')) || existsSync(join(dir, 'bun.lock'))) return 'bun';
} while (dir !== (dir = dirname(dir)));

return 'npm';
Expand Down

0 comments on commit 6671fa1

Please sign in to comment.