mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-12 18:49:41 -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.
52 lines
1.9 KiB
TypeScript
52 lines
1.9 KiB
TypeScript
import type { ProjectManifest, SupportedArchitectures } from '@pnpm/types'
|
|
import * as utils from '@pnpm/workspace.project-manifest-reader'
|
|
|
|
import { packageIsInstallable } from './packageIsInstallable.js'
|
|
|
|
export interface ReadProjectManifestOpts {
|
|
engineStrict?: boolean
|
|
nodeVersion?: string
|
|
supportedArchitectures?: SupportedArchitectures
|
|
}
|
|
|
|
interface BaseReadProjectManifestResult {
|
|
fileName: string
|
|
writeProjectManifest: (manifest: ProjectManifest, force?: boolean) => Promise<void>
|
|
}
|
|
|
|
export interface ReadProjectManifestResult extends BaseReadProjectManifestResult {
|
|
manifest: ProjectManifest
|
|
}
|
|
|
|
export async function readProjectManifest (
|
|
projectDir: string,
|
|
opts: ReadProjectManifestOpts = {}
|
|
): Promise<ReadProjectManifestResult> {
|
|
const { fileName, manifest, writeProjectManifest } = await utils.readProjectManifest(projectDir)
|
|
packageIsInstallable(projectDir, manifest as any, opts) // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
return { fileName, manifest, writeProjectManifest }
|
|
}
|
|
|
|
export async function readProjectManifestOnly (
|
|
projectDir: string,
|
|
opts: ReadProjectManifestOpts = {}
|
|
): Promise<ProjectManifest> {
|
|
const manifest = await utils.readProjectManifestOnly(projectDir)
|
|
packageIsInstallable(projectDir, manifest as any, opts) // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
return manifest
|
|
}
|
|
|
|
export interface TryReadProjectManifestResult extends BaseReadProjectManifestResult {
|
|
manifest: ProjectManifest | null
|
|
}
|
|
|
|
export async function tryReadProjectManifest (
|
|
projectDir: string,
|
|
opts: ReadProjectManifestOpts
|
|
): Promise<TryReadProjectManifestResult> {
|
|
const { fileName, manifest, writeProjectManifest } = await utils.tryReadProjectManifest(projectDir)
|
|
if (manifest == null) return { fileName, manifest, writeProjectManifest }
|
|
packageIsInstallable(projectDir, manifest as any, opts) // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
return { fileName, manifest, writeProjectManifest }
|
|
}
|