diff --git a/README.md b/README.md index c3a910b0..bbba3c82 100644 --- a/README.md +++ b/README.md @@ -152,9 +152,9 @@ team. - `--use-yarn` - By default, patch-package checks whether you use npm or yarn based on which - lockfile you have. If you have both, it uses npm by default. Set this option - to override that default and always use yarn. + By default, patch-package checks whether you use npm, yarn or bun based on + which lockfile you have. If you have multiple lockfiles, it uses npm by + default. Set this option to override that default and always use yarn. - `--exclude ` diff --git a/src/detectPackageManager.ts b/src/detectPackageManager.ts index 8ebf7f04..9508bae7 100644 --- a/src/detectPackageManager.ts +++ b/src/detectPackageManager.ts @@ -29,7 +29,7 @@ function printSelectingDefaultMessage() { console.info( `${chalk.bold( "patch-package", - )}: you have both yarn.lock and package-lock.json + )}: you have multiple lockfiles, e.g. yarn.lock and package-lock.json Defaulting to using ${chalk.bold("npm")} You can override this setting by passing --use-yarn or deleting package-lock.json if you don't need it @@ -54,7 +54,13 @@ export const detectPackageManager = ( const bunLockbExists = fs.existsSync( join(findWorkspaceRoot() ?? appRootPath, "bun.lockb"), ) - if ((packageLockExists || shrinkWrapExists) && yarnLockExists) { + if ( + [ + packageLockExists || shrinkWrapExists, + yarnLockExists, + bunLockbExists, + ].filter(Boolean).length > 1 + ) { if (overridePackageManager) { return overridePackageManager } else {