fix: support bun lockfile detection

This commit is contained in:
Peter Steinberger
2026-03-14 00:26:03 +00:00
parent 6ad2f793af
commit 285b50c549
2 changed files with 6 additions and 2 deletions

View File

@@ -19,9 +19,13 @@ describe("detectPackageManager", () => {
it("falls back to lockfiles when package.json is missing or unsupported", async () => {
const bunRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-detect-pm-"));
await fs.writeFile(path.join(bunRoot, "bun.lockb"), "", "utf8");
await fs.writeFile(path.join(bunRoot, "bun.lock"), "", "utf8");
await expect(detectPackageManager(bunRoot)).resolves.toBe("bun");
const legacyBunRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-detect-pm-"));
await fs.writeFile(path.join(legacyBunRoot, "bun.lockb"), "", "utf8");
await expect(detectPackageManager(legacyBunRoot)).resolves.toBe("bun");
const npmRoot = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-detect-pm-"));
await fs.writeFile(
path.join(npmRoot, "package.json"),

View File

@@ -19,7 +19,7 @@ export async function detectPackageManager(root: string): Promise<DetectedPackag
if (files.includes("pnpm-lock.yaml")) {
return "pnpm";
}
if (files.includes("bun.lockb")) {
if (files.includes("bun.lock") || files.includes("bun.lockb")) {
return "bun";
}
if (files.includes("package-lock.json")) {