From f5629098b27575b210c509bdfb540cc78c3cbdab Mon Sep 17 00:00:00 2001 From: Strengthless Date: Mon, 11 Sep 2023 02:26:16 +0800 Subject: [PATCH] Revert "Handle multiple lockfiles including Bun" This reverts commit d1d25b6a0c832d4da97e79df14434a9d254a4507. --- README.md | 6 +++--- src/detectPackageManager.ts | 10 ++-------- 2 files changed, 5 insertions(+), 11 deletions(-) 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 {