Skip to content

Commit

Permalink
feat: detect bun.lock (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Sep 25, 2024
1 parent 8cd67de commit 743a46f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const packageManagers: PackageManager[] = [
{
name: "bun",
command: "bun",
lockFile: "bun.lockb",
lockFile: ["bun.lockb", "bun.lock"],
},
{
name: "yarn",
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type PackageManager = {
command: string;
version?: string;
majorVersion?: string;
lockFile?: string;
lockFile?: string | string[];
files?: string[];
};

Expand Down

0 comments on commit 743a46f

Please sign in to comment.