fix: extend-node-path=false should work when lockfile is up-to-date

This commit is contained in:
Zoltan Kochan
2022-01-18 12:59:44 +02:00
parent 1cadc231a2
commit 43e4246d33
4 changed files with 12 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/headless": patch
---
`extendNodePath: false` should work.

View File

@@ -145,6 +145,7 @@ export default async function link (
const linkToBin = maybeOpts?.linkToBin ?? path.join(destModules, '.bin')
await linkBinsOfPackages(linkedPkgs.map((p) => ({ manifest: p.manifest, location: p.path })), linkToBin, {
extendNodePath: opts.extendNodePath,
warn: (message: string) => logger.info({ message, prefix: opts.dir }),
})

View File

@@ -22,6 +22,7 @@ interface StrictLinkOptions {
reporter: ReporterFunction
targetDependenciesField?: DependenciesField
dir: string
extendNodePath: boolean
hoistPattern: string[] | undefined
forceHoistPattern: boolean
@@ -53,6 +54,7 @@ async function defaults (opts: LinkOptions) {
return {
binsDir: path.join(dir, 'node_modules', '.bin'),
dir,
extendNodePath: true,
force: false,
forceSharedLockfile: false,
hoistPattern: undefined,

View File

@@ -446,7 +446,10 @@ export default async (opts: HeadlessOptions) => {
)
.filter(({ manifest }) => manifest != null) as Array<{ location: string, manifest: DependencyManifest }>,
project.binsDir,
{ warn: (message: string) => logger.info({ message, prefix: project.rootDir }) }
{
extendNodePath: opts.extendNodePath,
warn: (message: string) => logger.info({ message, prefix: project.rootDir }),
}
)
}
}))