fix: pass resolveSymlinks to directory-fetcher (#5644)

This commit is contained in:
Zoltan Kochan
2022-11-16 16:15:17 +02:00
committed by GitHub
parent 1f412c9222
commit 1d04e663ba
5 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
---
"@pnpm/core": minor
"@pnpm/headless": minor
"@pnpm/lifecycle": minor
---
New option added: resolveSymlinksInInjectedDirs.

View File

@@ -116,6 +116,7 @@ export interface StrictInstallOptions {
patchedDependencies?: Record<string, string>
allProjects: ProjectOptions[]
resolveSymlinksInInjectedDirs: boolean
}
export type InstallOptions =
@@ -199,6 +200,7 @@ const defaults = async (opts: InstallOptions) => {
workspacePackages: {},
enableModulesDir: true,
modulesCacheMaxAge: 7 * 24 * 60,
resolveSymlinksInInjectedDirs: false,
} as StrictInstallOptions
}

View File

@@ -245,6 +245,7 @@ export async function mutateModules (
extraBinPaths: opts.extraBinPaths,
extraEnv: opts.extraEnv,
rawConfig: opts.rawConfig,
resolveSymlinksInInjectedDirs: opts.resolveSymlinksInInjectedDirs,
scriptsPrependNodePath: opts.scriptsPrependNodePath,
scriptShell: opts.scriptShell,
shellEmulator: opts.shellEmulator,

View File

@@ -144,6 +144,7 @@ export interface HeadlessOptions {
wantedLockfile?: Lockfile
ownLifecycleHooksStdio?: 'inherit' | 'pipe'
pendingBuilds: string[]
resolveSymlinksInInjectedDirs?: boolean
skipped: Set<string>
enableModulesDir?: boolean
nodeLinker?: 'isolated' | 'hoisted' | 'pnp'
@@ -194,6 +195,7 @@ export async function headlessInstall (opts: HeadlessOptions) {
extraBinPaths: opts.extraBinPaths,
extraEnv: opts.extraEnv,
rawConfig: opts.rawConfig,
resolveSymlinksInInjectedDirs: opts.resolveSymlinksInInjectedDirs,
scriptsPrependNodePath: opts.scriptsPrependNodePath,
scriptShell: opts.scriptShell,
shellEmulator: opts.shellEmulator,

View File

@@ -11,6 +11,7 @@ export type RunLifecycleHooksConcurrentlyOptions = Omit<RunLifecycleHookOptions,
| 'pkgRoot'
| 'rootModulesDir'
> & {
resolveSymlinksInInjectedDirs?: boolean
storeController: StoreController
}
@@ -53,7 +54,7 @@ export async function runLifecycleHooksConcurrently (
await runLifecycleHook(stage, manifest, runLifecycleHookOpts)
}
if (targetDirs == null || targetDirs.length === 0) return
const filesResponse = await fetchFromDir(rootDir, {})
const filesResponse = await fetchFromDir(rootDir, { resolveSymlinks: opts.resolveSymlinksInInjectedDirs })
await Promise.all(
targetDirs.map(async (targetDir) => {
const targetModulesDir = path.join(targetDir, 'node_modules')