diff --git a/README.md b/README.md index 80f11b6b..54f52b9b 100644 --- a/README.md +++ b/README.md @@ -159,9 +159,9 @@ team. - `--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. + 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. - `--exclude ` diff --git a/src/detectPackageManager.ts b/src/detectPackageManager.ts index 9508bae7..8ebf7f04 100644 --- a/src/detectPackageManager.ts +++ b/src/detectPackageManager.ts @@ -29,7 +29,7 @@ function printSelectingDefaultMessage() { console.info( `${chalk.bold( "patch-package", - )}: you have multiple lockfiles, e.g. yarn.lock and package-lock.json + )}: you have both 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,13 +54,7 @@ export const detectPackageManager = ( const bunLockbExists = fs.existsSync( join(findWorkspaceRoot() ?? appRootPath, "bun.lockb"), ) - if ( - [ - packageLockExists || shrinkWrapExists, - yarnLockExists, - bunLockbExists, - ].filter(Boolean).length > 1 - ) { + if ((packageLockExists || shrinkWrapExists) && yarnLockExists) { if (overridePackageManager) { return overridePackageManager } else {