Skip to content

Commit

Permalink
feat: support bun
Browse files Browse the repository at this point in the history
  • Loading branch information
markthree committed Apr 5, 2024
1 parent de69a73 commit 32f0b95
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/pm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { execa } from "./process.ts"
import { find, findUp } from "./find.ts"
import { createUpBases } from "./deps.ts"

export type PmType = "npm" | "yarn" | "pnpm" | "deno"
export type PmType = "npm" | "yarn" | "pnpm" | "deno" | "bun"

export type NodePmType = Exclude<PmType, "deno">
export type NodePmType = Exclude<PmType, "deno" | "bun">

export type PmLock = {
"deno": "deno.lock"
Expand Down Expand Up @@ -44,7 +44,7 @@ export type PmCtx<T extends PmType = "npm"> = {

const pmCtx = createContext<PmCtx<PmType>>()

export const nodePms = ["npm", "pnpm", "yarn"] as const
export const nodePms = ["npm", "pnpm", "yarn", "bun"] as const

export async function initPm(root = Deno.cwd()) {
const type = await loadType(root)
Expand Down Expand Up @@ -211,6 +211,7 @@ export async function loadType(root = Deno.cwd()) {
"deno.jsonc",
"deno.json",
"deno.lock",
"bun.lockb",
"pnpm-lock.yaml",
"yarn.lock",
"package-lock.json",
Expand Down Expand Up @@ -278,5 +279,9 @@ export async function getTypeFormFile(file: string) {
return "yarn"
}

if (file.endsWith("bun.lockb")) {
return "bun"
}

return null
}

0 comments on commit 32f0b95

Please sign in to comment.