Skip to content

Comments

Check more auto locations for Node version#315

Open
TheJaredWilcurt wants to merge 8 commits intojasongin:masterfrom
TheJaredWilcurt:more-auto-checks
Open

Check more auto locations for Node version#315
TheJaredWilcurt wants to merge 8 commits intojasongin:masterfrom
TheJaredWilcurt:more-auto-checks

Conversation

@TheJaredWilcurt
Copy link

@TheJaredWilcurt TheJaredWilcurt commented Jan 9, 2026

This breaks out the logic into simple functions for looking up the Node version in various locations/files, and adds in some new spots.

Checks for the Node version in these places, in this order:

File Location Value Notes
package.json { devEngines: { runtime: ">= 24.0.0" } } } '>= 24.0.0' Shorthand (for future-proofing)
package.json { devEngines: { runtime: { name: "node", version: ">= 24.0.0" } } } '>= 24.0.0' Official spec
package.json { volta: { node: "24.0.0" } } '24.0.0' Might as well, we already parsed the JSON
.node-version 24.0.0 '24.0.0' Same as before
.nvmrc 24.0.0 '24.0.0' Same as before
.prototools node = "24.0.0" '24.0.0' Manually parses out the version
mise.toml [tools]\nnode = "24.0.0" '24.0.0' Manually parses out the version

The devEngines are the only one of these I think absolutely has to be there, since it is now officially part of the package.json spec, the rest are optional 3rd party locations and could be removed.

One downside is the current NodeVersion.parse function does not handle ranges, such as NodeVersion.parse('>= 24.0.0'). It requires an exact version, like NodeVersion.parse('24.0.0'). But the devEngines officially support ranges.

  • Option A: Accept that people will need to set their devEngine to an exact version (this is a best practice anyway).
  • Option B: Add in more code to this PR to remove the range and convert it to an exact version. I'd probably use require('semver') for this.
  • Option C: Add in more code to this PR to better support ranges.

@TheJaredWilcurt
Copy link
Author

@jasongin Ready for review, open to feedback.

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.

1 participant