Skip to content

Commit f5e4a39

Browse files
committed
fix(yarn): handle global for yarn 1.x only
1 parent 15aaee8 commit f5e4a39

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/api.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export async function addDependency(
4949
resolvedOptions.packageManager.name === "yarn"
5050
? [
5151
...getWorkspaceArgs(resolvedOptions),
52+
// Global is not supported in berry: yarnpkg/berry#821
53+
resolvedOptions.global &&
54+
resolvedOptions.packageManager.majorVersion === "1"
55+
? "global"
56+
: "",
5257
"add",
5358
resolvedOptions.dev ? "-D" : "",
5459
...names,
@@ -108,11 +113,10 @@ export async function removeDependency(
108113
const args = (
109114
resolvedOptions.packageManager.name === "yarn"
110115
? [
111-
// prettier-ignore
112-
resolvedOptions.global
113-
? (resolvedOptions.packageManager.majorVersion === "1"
114-
? "dlx"
115-
: "global")
116+
// Global is not supported in berry: yarnpkg/berry#821
117+
resolvedOptions.global &&
118+
resolvedOptions.packageManager.majorVersion === "1"
119+
? "global"
116120
: "",
117121
...getWorkspaceArgs(resolvedOptions),
118122
"remove",

0 commit comments

Comments
 (0)