Skip to content

Commit

Permalink
support bun.lock as package manager lockfile (vercel#74056)
Browse files Browse the repository at this point in the history
  • Loading branch information
RiskyMH authored Dec 19, 2024
1 parent 53bb90c commit 4fda39c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/next-codemod/lib/handle-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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:
Expand Down
8 changes: 7 additions & 1 deletion packages/next/src/lib/find-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down

0 comments on commit 4fda39c

Please sign in to comment.