mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-06 22:18:17 -05:00
fix: dlx should work without a configured global directory (#4612)
* fix: dlx should work without a configured global directory close #4597 * docs: add changesets
This commit is contained in:
5
.changeset/many-fireants-design.md
Normal file
5
.changeset/many-fireants-design.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-script-runners": patch
|
||||
---
|
||||
|
||||
`pnpm dlx` should work without a configure global directory.
|
||||
5
.changeset/red-deers-deny.md
Normal file
5
.changeset/red-deers-deny.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
---
|
||||
|
||||
Allow to pass `global-bin-dir` through CLI options to the `add` command.
|
||||
@@ -18,6 +18,7 @@ export function rcOptionsTypes () {
|
||||
'fetch-retry-mintimeout',
|
||||
'fetch-timeout',
|
||||
'force',
|
||||
'global-bin-dir',
|
||||
'global-dir',
|
||||
'global-pnpmfile',
|
||||
'global',
|
||||
|
||||
@@ -61,15 +61,24 @@ export async function handler (
|
||||
})
|
||||
await rimraf(bins)
|
||||
const pkgs = opts.package ?? params.slice(0, 1)
|
||||
const pnpmArgs = ['add', ...pkgs, '--global', '--global-dir', prefix, '--dir', prefix]
|
||||
const pnpmArgs = [
|
||||
'add',
|
||||
...pkgs,
|
||||
'--global',
|
||||
`--global-dir=${prefix}`,
|
||||
`--dir=${prefix}`,
|
||||
`--config.global-bin-dir=${bins}`,
|
||||
]
|
||||
if (opts.reporter) {
|
||||
pnpmArgs.push(`--reporter=${opts.reporter}`)
|
||||
}
|
||||
const env = makeEnv({ userAgent: opts.userAgent, prependPaths: [bins] })
|
||||
await execa('pnpm', pnpmArgs, {
|
||||
env,
|
||||
stdio: 'inherit',
|
||||
})
|
||||
await execa(versionless(scopeless(params[0])), params.slice(1), {
|
||||
env: makeEnv({ userAgent: opts.userAgent, prependPaths: [bins] }),
|
||||
env,
|
||||
stdio: 'inherit',
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user