mirror of
https://github.com/pnpm/pnpm.git
synced 2026-05-30 03:26:43 -04:00
Fixes #11818 ## Summary `devEngines.runtime` / `engines.runtime` entries with `onFail: error` or `warn` silently did nothing — only `onFail: download` had any effect. This PR wires up validation for all three supported runtimes (node, deno, bun). - Add `getSystemDenoVersion` / `getSystemBunVersion` and a generic `getSystemRuntimeVersion(name)` dispatcher in the runtime-version helper package. - Walk each runtime entry in the manifest during pnpm startup, compare to the live system runtime, and throw `ERR_PNPM_BAD_RUNTIME_VERSION` (or warn) on a mismatch. Invalid ranges (e.g. `"invalid range"`) are reported instead of crashing `semver.minVersion`. Missing runtimes ("no Node.js on the system") get the same error path. - The shell-out for deno/bun only runs when the manifest configures them AND `onFail` is `error`/`warn`. `download`/`ignore` short-circuit, and projects with no runtime pin pay nothing. Memoized per runtime. - `pnpm --version`, `pnpm --help`, and `pnpm <cmd> --global` are exempt from the check. - Rename `@pnpm/engine.runtime.system-node-version` → `@pnpm/engine.runtime.system-version` to match its broader scope; hoist `RuntimeName` / `RUNTIME_NAMES` / `isRuntimeAlias` to `@pnpm/types` so callers don't need to depend on `pkg-manifest.utils` just for the alias check. ## Tests - `pnpm --filter pnpm run compile` - `pnpm --filter pnpm exec jest packageManagerCheck.test` — 42 passing. New coverage: node/deno/bun version mismatch, invalid range, missing range, multi-entry runtime arrays, `engines.runtime` path (not just `devEngines.runtime`), and the `pnpm --version` exemption. - `pnpm --filter @pnpm/engine.runtime.system-version test` — 10 passing, 100% statement coverage; unit tests for each helper and the dispatcher. - Manual end-to-end smoke tests against the rebuilt bundle for deno and bun version mismatch. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added runtime version validation for Node.js, Deno, and Bun. The system now enforces `devEngines.runtime` and `engines.runtime` declarations with configurable failure behavior (`error`, `warn`, or `ignore`). * Enhanced error messages for runtime version mismatches with helpful suggestions for overrides. * **Improvements** * Improved system runtime detection and version checking across multiple runtime environments. --------- Co-authored-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com> Co-authored-by: Zoltan Kochan <z@kochan.io>
107 lines
1.8 KiB
JSON
107 lines
1.8 KiB
JSON
{
|
|
"extends": "@pnpm/tsconfig",
|
|
"compilerOptions": {
|
|
"outDir": "lib",
|
|
"rootDir": "src"
|
|
},
|
|
"include": [
|
|
"src/**/*.ts",
|
|
"../../__typings__/**/*.d.ts"
|
|
],
|
|
"references": [
|
|
{
|
|
"path": "../../__utils__/prepare"
|
|
},
|
|
{
|
|
"path": "../../__utils__/test-ipc-server"
|
|
},
|
|
{
|
|
"path": "../../bins/resolver"
|
|
},
|
|
{
|
|
"path": "../../building/commands"
|
|
},
|
|
{
|
|
"path": "../../catalogs/resolver"
|
|
},
|
|
{
|
|
"path": "../../cli/command"
|
|
},
|
|
{
|
|
"path": "../../cli/common-cli-options-help"
|
|
},
|
|
{
|
|
"path": "../../cli/utils"
|
|
},
|
|
{
|
|
"path": "../../config/reader"
|
|
},
|
|
{
|
|
"path": "../../config/version-policy"
|
|
},
|
|
{
|
|
"path": "../../core/core-loggers"
|
|
},
|
|
{
|
|
"path": "../../core/error"
|
|
},
|
|
{
|
|
"path": "../../core/logger"
|
|
},
|
|
{
|
|
"path": "../../core/types"
|
|
},
|
|
{
|
|
"path": "../../crypto/hash"
|
|
},
|
|
{
|
|
"path": "../../deps/status"
|
|
},
|
|
{
|
|
"path": "../../engine/runtime/commands"
|
|
},
|
|
{
|
|
"path": "../../engine/runtime/system-version"
|
|
},
|
|
{
|
|
"path": "../../installing/client"
|
|
},
|
|
{
|
|
"path": "../../installing/commands"
|
|
},
|
|
{
|
|
"path": "../../pkg-manifest/reader"
|
|
},
|
|
{
|
|
"path": "../../resolving/parse-wanted-dependency"
|
|
},
|
|
{
|
|
"path": "../../shell/path"
|
|
},
|
|
{
|
|
"path": "../../store/path"
|
|
},
|
|
{
|
|
"path": "../../testing/command-defaults"
|
|
},
|
|
{
|
|
"path": "../../workspace/injected-deps-syncer"
|
|
},
|
|
{
|
|
"path": "../../workspace/project-manifest-reader"
|
|
},
|
|
{
|
|
"path": "../../workspace/projects-filter"
|
|
},
|
|
{
|
|
"path": "../../workspace/projects-sorter"
|
|
},
|
|
{
|
|
"path": "../lifecycle"
|
|
},
|
|
{
|
|
"path": "../pnpm-cli-runner"
|
|
}
|
|
]
|
|
}
|