fix(dlx): do not modify the lockfile in the cwd (#4762)

close #4743
This commit is contained in:
Zoltan Kochan
2022-05-19 03:59:09 +03:00
committed by GitHub
parent e6a9f157d6
commit dddff37099
2 changed files with 10 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-script-runners": patch
"pnpm": patch
---
`pnpm dlx` shouldn't modify the lockfile in the current working directory [#4743](https://github.com/pnpm/pnpm/issues/4743).

View File

@@ -9,6 +9,7 @@ import { fromDir as readPkgFromDir } from '@pnpm/read-package-json'
import packageBins from '@pnpm/package-bins'
import storePath from '@pnpm/store-path'
import execa from 'execa'
import omit from 'ramda/src/omit'
import renderHelp from 'render-help'
import { makeEnv } from './makeEnv'
@@ -71,9 +72,10 @@ export async function handler (
const pkgs = opts.package ?? [command]
const env = makeEnv({ userAgent: opts.userAgent, prependPaths: [binsDir] })
await add.handler({
...opts,
dir: prefix,
...omit(['workspaceDir'], opts),
bin: binsDir,
dir: prefix,
lockfileDir: prefix,
}, pkgs)
const binName = opts.package
? command