From 32f0b95e8084a867ce1eabb61a934a610cd68e22 Mon Sep 17 00:00:00 2001 From: markthree <1801982702@qq.com> Date: Fri, 5 Apr 2024 17:56:29 +0800 Subject: [PATCH] feat: support bun --- src/pm.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pm.ts b/src/pm.ts index 91f30ca..40b1430 100644 --- a/src/pm.ts +++ b/src/pm.ts @@ -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 +export type NodePmType = Exclude export type PmLock = { "deno": "deno.lock" @@ -44,7 +44,7 @@ export type PmCtx = { const pmCtx = createContext>() -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) @@ -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", @@ -278,5 +279,9 @@ export async function getTypeFormFile(file: string) { return "yarn" } + if (file.endsWith("bun.lockb")) { + return "bun" + } + return null }