-
Notifications
You must be signed in to change notification settings - Fork 327
Description
From a discussion on Discord, along with the multiple questions we've had around using engines instead of the custom volta key in package.json: One possible way to improve interoperability and convenience would be to change how the version is resolved when a user runs volta pin node.
Currently, it will find the latest LTS Node version and use that. However, we could update that logic to read the engines key and find the latest version that fits into that range (possibly the latest LTS that fits, to maintain the existing behavior). We could also look for .nvmrc or .node-version files and use those to resolve. We likely wouldn't be able to support everything that is supported by those files, but we could get close and show an informational message about why we couldn't read a version.
This would allow users to conveniently pull the value when engines (or other sources) were updated, while still maintaining Volta's model that requires a concrete version. It also would still be easy to be more explicit, using the volta pin node@<version> syntax, so there wouldn't be any loss of control over the installed version.
We'll need to define the precedence order for when there are multiple sources, as well as document well how it works. We'd also need to decide if this counts as a breaking change or not (I would lean towards it being an enhancement, bumping the minor version, not a breaking change, but I'm open to being convinced otherwise).