Skip to content

Commit 285b50c

Browse files
committed
fix: support bun lockfile detection
1 parent 6ad2f79 commit 285b50c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/infra/detect-package-manager.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ describe("detectPackageManager", () => {
1919

2020
it("falls back to lockfiles when package.json is missing or unsupported", async () => {
2121
const bunRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-detect-pm-"));
22-
await fs.writeFile(path.join(bunRoot, "bun.lockb"), "", "utf8");
22+
await fs.writeFile(path.join(bunRoot, "bun.lock"), "", "utf8");
2323
await expect(detectPackageManager(bunRoot)).resolves.toBe("bun");
2424

25+
const legacyBunRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-detect-pm-"));
26+
await fs.writeFile(path.join(legacyBunRoot, "bun.lockb"), "", "utf8");
27+
await expect(detectPackageManager(legacyBunRoot)).resolves.toBe("bun");
28+
2529
const npmRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-detect-pm-"));
2630
await fs.writeFile(
2731
path.join(npmRoot, "package.json"),

src/infra/detect-package-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export async function detectPackageManager(root: string): Promise<DetectedPackag
1919
if (files.includes("pnpm-lock.yaml")) {
2020
return "pnpm";
2121
}
22-
if (files.includes("bun.lockb")) {
22+
if (files.includes("bun.lock") || files.includes("bun.lockb")) {
2323
return "bun";
2424
}
2525
if (files.includes("package-lock.json")) {

0 commit comments

Comments
 (0)