Repository navigation
fix(node): fall back to volta, .nvmrc and .node-version for the Node runtime - #699
Merged
vibgrate-team merged 1 commit intoNov 25, 2026
Merged
Conversation
…runtime The Node runtime came only from engines.node, so packages that pin Node with volta.node, .nvmrc or .node-version reported no runtime or runtime lag. When engines.node is absent, try volta.node, then .nvmrc, then .node-version in the package directory. A leading v is stripped and bare majors are kept. lts/<codename> maps to its major only when the runtime catalog has that cycle; anything unmappable is skipped rather than guessed, so a later source can still apply and otherwise the runtime stays empty. Closes vibgrate#628 Signed-off-by: Noah Khomer <108771853+noahkhomer18@users.noreply.github.com>
Contributor
|
Thanks so much @noahkhomer18 — falling back to Volta, .nvmrc and .node-version for the Node runtime is a really practical improvement, and the tests you added make it easy to trust. Great work, and we'd love to see more from you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #628.
The Node runtime came only from
engines.node(around line 313 ofnode-scanner.ts), so packages that pin Node withvolta.node,.nvmrcor.node-versiongot no runtime and no runtime lag.When
engines.nodeis absent, the scanner now triesvolta.node, then.nvmrc, then.node-versionin the package directory, in the order you gave.vis stripped and bare majors such as20are kept.lts/<codename>maps to its major only when the runtime catalog has that cycle. The catalog does not store codenames, so a small name-to-major table (argon through krypton) does the lookup, and the catalog decides whether that major is known.system,node, free text) is skipped rather than guessed, so a later source can still apply, and otherwise the runtime stays empty.Tests:
test/node-runtime-pin.test.ts, each case with and withoutFileCache:.nvmrcv20.11.1reports runtime20.11.1with a runtime lagengines.nodestill wins over volta and the pin filesvolta.nodebeats.nvmrc.nvmrcfalls through to.node-version20andlts/ironboth mapWith the scanner change reverted, 8 of 12 fail; the 4 that pass are the "engines.node wins" and "stays empty" cases, which are today's behaviour.
Checks:
pnpm testgives 591 files, 5882 tests passing (5870 onmain).tsc --noEmitandeslinton the scanner are clean.#665 also touches
node-scanner.ts, but in the lockfile fallback a long way from this hunk, so the two merge independently.