From 743a46fc0a15bb0c7417fd1e0a002376aa698181 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Thu, 26 Sep 2024 00:54:38 +0200 Subject: [PATCH] feat: detect `bun.lock` (#153) --- src/package-manager.ts | 8 +++++--- src/types.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/package-manager.ts b/src/package-manager.ts index 6b6dfcd..7f3a6cf 100644 --- a/src/package-manager.ts +++ b/src/package-manager.ts @@ -47,7 +47,7 @@ export const packageManagers: PackageManager[] = [ { name: "bun", command: "bun", - lockFile: "bun.lockb", + lockFile: ["bun.lockb", "bun.lock"], }, { name: "yarn", @@ -109,8 +109,10 @@ export async function detectPackageManager( for (const packageManager of packageManagers) { const detectionsFiles = [ packageManager.lockFile, - ...(packageManager.files || []), - ].filter(Boolean) as string[]; + packageManager.files, + ] + .flat() + .filter(Boolean) as string[]; if (detectionsFiles.some((file) => existsSync(resolve(path, file)))) { return { diff --git a/src/types.ts b/src/types.ts index f70b8d5..b0441a9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -5,7 +5,7 @@ export type PackageManager = { command: string; version?: string; majorVersion?: string; - lockFile?: string; + lockFile?: string | string[]; files?: string[]; };