Skip to content

Commit 6671fa1

Browse files
RiskyMHteemingc
andauthored
feat: adapter-auto support bun add (#12854)
* 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>
1 parent 0ab1733 commit 6671fa1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/serious-geckos-itch.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-auto': minor
3+
---
4+
5+
feat: add support for Bun package manager

packages/adapter-auto/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import process from 'node:process';
1010
const commands = {
1111
npm: (name, version) => `npm install -D ${name}@${version}`,
1212
pnpm: (name, version) => `pnpm add -D ${name}@${version}`,
13-
yarn: (name, version) => `yarn add -D ${name}@${version}`
13+
yarn: (name, version) => `yarn add -D ${name}@${version}`,
14+
bun: (name, version) => `bun add -D ${name}@${version}`
1415
};
1516

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

2527
return 'npm';

0 commit comments

Comments
 (0)