Skip to content

Commit f562e13

Browse files
committed
fix: add pnpm v11 workaround flags to CLI install flags (workspace yaml not read by all code paths)
1 parent aa242b7 commit f562e13

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

scripts/npm/install-npm-packages.mjs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,14 +753,28 @@ async function installPackage(packageInfo) {
753753

754754
// pnpm v11 ignores overrides in package.json pnpm.overrides for subdependencies
755755
// (regression from v10). Overrides in pnpm-workspace.yaml still work.
756-
// Write overrides to pnpm-workspace.yaml for pnpm, or package.json for npm.
757-
if (packageManager === 'pnpm' && Object.keys(pnpmOverrides).length > 0) {
756+
// Also set pnpm v11 settings in workspace yaml since CLI --config flags
757+
// may not override workspace-level settings.
758+
if (packageManager === 'pnpm') {
758759
const overrideLines = Object.entries(pnpmOverrides)
759760
.map(([pkg, spec]) => ` ${pkg}: '${spec}'`)
760761
.join('\n')
762+
const overridesSection =
763+
Object.keys(pnpmOverrides).length > 0
764+
? `\noverrides:\n${overrideLines}\n`
765+
: ''
761766
await fs.writeFile(
762767
path.join(packageTempDir, 'pnpm-workspace.yaml'),
763-
`packages:\n - .\n\noverrides:\n${overrideLines}\n`,
768+
[
769+
'packages:',
770+
' - .',
771+
'',
772+
'# pnpm v11 settings for third-party test installs.',
773+
'blockExoticSubdeps: false',
774+
'strictDepBuilds: false',
775+
'resolutionMode: highest',
776+
overridesSection,
777+
].join('\n'),
764778
'utf8',
765779
)
766780
} else if (packageManager === 'npm') {

scripts/utils/package.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@ const PNPM_NPM_LIKE_FLAGS = [
3030
]
3131

3232
// Basic pnpm install flags for CI-friendly behavior.
33+
// These are for isolated test installs of third-party packages we don't control.
3334
const PNPM_INSTALL_BASE_FLAGS = [
35+
// Allow git-resolved subdeps in third-party packages (e.g. evalmd → markdown-it).
36+
'--config.block-exotic-subdeps=false',
3437
// Prevent interactive prompts in CI environments.
3538
'--config.confirmModulesPurge=false',
39+
// Tell pnpm the registry may not have time metadata (SFW proxy strips it).
40+
'--config.registry-supports-time-field=false',
41+
// Use highest resolution to avoid time-based resolution failures.
42+
'--config.resolution-mode=highest',
43+
// Allow third-party build scripts (e.g. core-js, es5-ext postinstall).
44+
'--config.strict-dep-builds=false',
3645
// Allow lockfile updates (required for test package installations).
3746
'--no-frozen-lockfile',
3847
]

0 commit comments

Comments
 (0)