Skip to content

fix(node): fall back to volta, .nvmrc and .node-version for the Node runtime - #699

Merged
vibgrate-team merged 1 commit into
vibgrate:mainfrom
noahkhomer18:fix/628-node-runtime-pins
Nov 25, 2026
Merged

vibgrate-team merged 1 commit into
vibgrate:mainfrom
noahkhomer18:fix/628-node-runtime-pins

Conversation

@noahkhomer18

Copy link
Copy Markdown
Contributor

Closes #628.

The Node runtime came only from engines.node (around line 313 of node-scanner.ts), so packages that pin Node with volta.node, .nvmrc or .node-version got no runtime and no runtime lag.

When engines.node is absent, the scanner now tries volta.node, then .nvmrc, then .node-version in the package directory, in the order you gave.

  • A leading v is stripped and bare majors such as 20 are 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.
  • Anything that cannot be mapped (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 without FileCache:

  • .nvmrc v20.11.1 reports runtime 20.11.1 with a runtime lag
  • engines.node still wins over volta and the pin files
  • volta.node beats .nvmrc
  • an unmappable .nvmrc falls through to .node-version
  • a bare 20 and lts/iron both map
  • an unmappable value leaves runtime, latest and lag empty

With 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 test gives 591 files, 5882 tests passing (5870 on main). tsc --noEmit and eslint on 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.

…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>
@vibgrate-team
vibgrate-team merged commit b5294a8 into vibgrate:main Nov 25, 2026
1 check passed
@vibgrate-team

Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: fall back to .nvmrc, .node-version or volta.node for the Node.js runtime

2 participants