File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,8 @@ team.
161
161
162
162
By default, patch-package checks whether you use npm, yarn or bun based on
163
163
which lockfile you have. If you have multiple lockfiles, it uses npm by
164
- default. Set this option to override that default and always use yarn.
164
+ default (in cases where npm is not available, it will resort to yarn). Set
165
+ this option to override that default and always use yarn.
165
166
166
167
- ` --use-bun`
167
168
Original file line number Diff line number Diff line change @@ -45,6 +45,18 @@ deleting the conflicting lockfile if you don't need it
45
45
)
46
46
}
47
47
48
+ function printSelectingDefaultYarnMessage ( ) {
49
+ console . info (
50
+ `${ chalk . bold (
51
+ "patch-package" ,
52
+ ) } : you have both yarn.lock and bun.lockb lockfiles
53
+ Defaulting to using ${ chalk . bold ( "yarn" ) }
54
+ You can override this setting by passing --use-bun, or
55
+ deleting yarn.lock if you don't need it
56
+ ` ,
57
+ )
58
+ }
59
+
48
60
function checkForYarnOverride ( overridePackageManager : PackageManager | null ) {
49
61
if ( overridePackageManager === "yarn" ) {
50
62
printNoYarnLockfileError ( )
@@ -86,6 +98,11 @@ export const detectPackageManager = (
86
98
if ( overridePackageManager ) {
87
99
return overridePackageManager
88
100
}
101
+ if ( ! packageLockExists && ! shrinkWrapExists ) {
102
+ // The only case where we don't want to default to npm is when we have both yarn and bun lockfiles.
103
+ printSelectingDefaultYarnMessage ( )
104
+ return "yarn"
105
+ }
89
106
printSelectingDefaultMessage ( )
90
107
return shrinkWrapExists ? "npm-shrinkwrap" : "npm"
91
108
} else if ( packageLockExists || shrinkWrapExists ) {
Original file line number Diff line number Diff line change @@ -200,7 +200,8 @@ Usage:
200
200
201
201
By default, patch-package checks whether you use npm, yarn or bun based on
202
202
which lockfile you have. If you have multiple lockfiles, it uses npm by
203
- default. Set this option to override that default and always use yarn.
203
+ default (in cases where npm is not available, it will resort to yarn). Set
204
+ this option to override that default and always use yarn.
204
205
205
206
${ chalk . bold ( "--use-bun" ) }
206
207
You can’t perform that action at this time.
0 commit comments