Skip to content

Commit

Permalink
spawnYarn: args must go after yarn options (#1362).
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Jan 25, 2024
1 parent c657e25 commit 3679b1a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/package-managers/bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ async function spawnBun(
args = Array.isArray(args) ? args : [args]

const fullArgs = [
...args,
...(npmOptions.prefix ? `--prefix=${npmOptions.prefix}` : []),
...(npmOptions.global ? ['--global'] : []),
...args,
]

return spawn('bun', fullArgs, spawnOptions)
Expand Down
2 changes: 1 addition & 1 deletion src/package-managers/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,10 @@ async function spawnNpm(
args = Array.isArray(args) ? args : [args]

const fullArgs = [
...args,
...(npmOptions.global ? [`--global`] : []),
...(npmOptions.prefix ? [`--prefix=${npmOptions.prefix}`] : []),
'--json',
...args,
]
return spawn(cmd, fullArgs, spawnOptions)
}
Expand Down
3 changes: 2 additions & 1 deletion src/package-managers/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ async function spawnYarn(

const fullArgs = [
...(yarnOptions.global ? 'global' : []),
...(Array.isArray(args) ? args : [args]),
'--depth=0',
...(yarnOptions.prefix ? `--prefix=${yarnOptions.prefix}` : []),
'--json',
'--no-progress',
// args must go after yarn options, otherwise they are passed through to npm scripts
...(Array.isArray(args) ? args : [args]),
]

return spawn(cmd, fullArgs, spawnOptions)
Expand Down

0 comments on commit 3679b1a

Please sign in to comment.