fix: ignore the engines.pnpm field of dependencies (#7968)

close #7965
This commit is contained in:
Zoltan Kochan
2024-04-19 02:49:01 +02:00
committed by GitHub
parent eb1947576f
commit b7d2ed47be
6 changed files with 12 additions and 7 deletions

View File

@@ -0,0 +1,9 @@
---
"@pnpm/package-requester": patch
"@pnpm/filter-lockfile": patch
"@pnpm/headless": patch
"@pnpm/deps.graph-builder": patch
"pnpm": patch
---
The `engines.pnpm` field in the `package.json` files of dependencies should be ignored [#7965](https://github.com/pnpm/pnpm/issues/7965).

View File

@@ -120,7 +120,6 @@ export async function lockfileToDepGraph (
lockfileDir: opts.lockfileDir,
nodeVersion: opts.nodeVersion,
optional: pkgSnapshot.optional === true,
pnpmVersion: opts.pnpmVersion,
supportedArchitectures: opts.supportedArchitectures,
}) === false
) {

View File

@@ -168,7 +168,6 @@ function pkgAllDeps (
lockfileDir: opts.lockfileDir,
nodeVersion: opts.currentEngine.nodeVersion,
optional: pkgSnapshot.optional === true,
pnpmVersion: opts.currentEngine.pnpmVersion,
supportedArchitectures: opts.supportedArchitectures,
}) !== false
if (!installable) {

View File

@@ -161,7 +161,7 @@ test('skip optional dependency that does not support the current Node version',
expect(reportedTimes).toBe(1)
})
test('skip optional dependency that does not support the current pnpm version', async () => {
test('do not skip optional dependency that does not support the current pnpm version', async () => {
const project = prepareEmpty()
const reporter = sinon.spy()
@@ -175,7 +175,7 @@ test('skip optional dependency that does not support the current pnpm version',
pnpmVersion: '4.0.0',
}))
project.hasNot('@pnpm.e2e/for-legacy-pnpm')
project.has('@pnpm.e2e/for-legacy-pnpm')
project.storeHas('@pnpm.e2e/for-legacy-pnpm', '1.0.0')
const logMatcher = sinon.match({
@@ -187,7 +187,7 @@ test('skip optional dependency that does not support the current pnpm version',
reason: 'unsupported_engine',
})
const reportedTimes = reporter.withArgs(logMatcher).callCount
expect(reportedTimes).toBe(1)
expect(reportedTimes).toBe(0)
})
test('don\'t skip optional dependency that does not support the current OS when forcing', async () => {

View File

@@ -185,7 +185,6 @@ async function fetchDeps (
lockfileDir: opts.lockfileDir,
nodeVersion: opts.nodeVersion,
optional: pkgSnapshot.optional === true,
pnpmVersion: opts.pnpmVersion,
supportedArchitectures: opts.supportedArchitectures,
}) === false
) {

View File

@@ -235,7 +235,6 @@ async function resolveAndFetch (
lockfileDir: options.lockfileDir,
nodeVersion: ctx.nodeVersion,
optional: wantedDependency.optional === true,
pnpmVersion: ctx.pnpmVersion,
supportedArchitectures: options.supportedArchitectures,
})
)