mirror of
https://github.com/pnpm/pnpm.git
synced 2026-06-09 17:05:09 -04:00
* feat!: remove managePackageManagerVersions / packageManagerStrict / packageManagerStrictVersion
These three settings existed only to derive the `onFail` behavior for
the legacy `packageManager` field. The `pmOnFail` setting introduced
in #11275 subsumes all three — it directly sets `onFail` for both
`packageManager` and `devEngines.packageManager`.
Legacy `packageManager` now defaults to `onFail: 'download'` when no
override is set. `COREPACK_ENABLE_STRICT` is no longer read (it only
gated `packageManagerStrict`); `pmOnFail` is the replacement.
Also drops pass-through `packageManagerStrict*` option fields from
cli.utils / workspace.projects-reader (they were unused) and the
unused `managePackageManagerVersions` Pick in engine.pm.commands'
`SelfUpdateCommandOptions`.
* fix: use kebab-case setting name in BAD_PM_VERSION hint
Copilot review feedback: user-facing error hints for configuration keys
conventionally use the kebab-case form that matches both the CLI flag
(`--pm-on-fail`) and the `.npmrc` key, consistent with the prior hint
text that referenced `package-manager-strict`. The `pnpm-workspace.yaml`
field (`pmOnFail`) is camelCase but that mapping is documented
elsewhere.
* Revert "fix: use kebab-case setting name in BAD_PM_VERSION hint"
This reverts commit e03c29b17. pnpm-workspace.yaml uses camelCase
(`pmOnFail`) — the primary config location for pnpm 11 — so the
hint keeps the camelCase form. The CLI flag is already shown
alongside.
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { packageManager } from '@pnpm/cli.meta'
|
|
import { checkPackage, UnsupportedEngineError, type WantedEngine } from '@pnpm/config.package-is-installable'
|
|
import { logger } from '@pnpm/logger'
|
|
import type { SupportedArchitectures } from '@pnpm/types'
|
|
|
|
export function packageIsInstallable (
|
|
pkgPath: string,
|
|
pkg: {
|
|
packageManager?: string
|
|
engines?: WantedEngine
|
|
cpu?: string[]
|
|
os?: string[]
|
|
libc?: string[]
|
|
},
|
|
opts: {
|
|
engineStrict?: boolean
|
|
nodeVersion?: string
|
|
supportedArchitectures?: SupportedArchitectures
|
|
}
|
|
): void {
|
|
const currentPnpmVersion = packageManager.name === 'pnpm'
|
|
? packageManager.version
|
|
: undefined
|
|
const err = checkPackage(pkgPath, pkg, {
|
|
nodeVersion: opts.nodeVersion,
|
|
pnpmVersion: currentPnpmVersion,
|
|
supportedArchitectures: opts.supportedArchitectures ?? {
|
|
os: ['current'],
|
|
cpu: ['current'],
|
|
libc: ['current'],
|
|
},
|
|
})
|
|
if (err === null) return
|
|
if (
|
|
(err instanceof UnsupportedEngineError && err.wanted.pnpm) ??
|
|
opts.engineStrict
|
|
) throw err
|
|
logger.warn({
|
|
message: `Unsupported ${
|
|
err instanceof UnsupportedEngineError ? 'engine' : 'platform'
|
|
}: wanted: ${JSON.stringify(err.wanted)} (current: ${JSON.stringify(err.current)})`,
|
|
prefix: pkgPath,
|
|
})
|
|
}
|