From 4fda39ce1069efabd2c7a68da3963cf1840572e7 Mon Sep 17 00:00:00 2001 From: Michael H Date: Fri, 20 Dec 2024 00:46:35 +1100 Subject: [PATCH] support `bun.lock` as package manager lockfile (#74056) --- packages/next-codemod/lib/handle-package.ts | 9 ++++++++- packages/next/src/lib/find-root.ts | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/next-codemod/lib/handle-package.ts b/packages/next-codemod/lib/handle-package.ts index 7e1c53aae35d8..2a9f299f7b442 100644 --- a/packages/next-codemod/lib/handle-package.ts +++ b/packages/next-codemod/lib/handle-package.ts @@ -7,7 +7,13 @@ export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun' export function getPkgManager(baseDir: string): PackageManager { try { const lockFile = findUp.sync( - ['package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb'], + [ + 'package-lock.json', + 'yarn.lock', + 'pnpm-lock.yaml', + 'bun.lock', + 'bun.lockb', + ], { cwd: baseDir } ) if (lockFile) { @@ -18,6 +24,7 @@ export function getPkgManager(baseDir: string): PackageManager { return 'yarn' case 'pnpm-lock.yaml': return 'pnpm' + case 'bun.lock': case 'bun.lockb': return 'bun' default: diff --git a/packages/next/src/lib/find-root.ts b/packages/next/src/lib/find-root.ts index b6674c512fd67..3821a19583dfe 100644 --- a/packages/next/src/lib/find-root.ts +++ b/packages/next/src/lib/find-root.ts @@ -3,7 +3,13 @@ import findUp from 'next/dist/compiled/find-up' export function findRootLockFile(cwd: string) { return findUp.sync( - ['pnpm-lock.yaml', 'package-lock.json', 'yarn.lock', 'bun.lockb'], + [ + 'pnpm-lock.yaml', + 'package-lock.json', + 'yarn.lock', + 'bun.lock', + 'bun.lockb', + ], { cwd, }