Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adapter-auto support bun add #12854

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading