volta icon indicating copy to clipboard operation
volta copied to clipboard

volta respects engines property of package.json

Open barinbritva opened this issue 2 years ago • 3 comments

Now volta creates own property volta and uses only it. It would be extremely convenient if volta have a look for volta prop first and if it's not found it looks for engines prop.

A few points:

  • In most cases it's enough to specify only major version in engines prop of a tool instead of major.minor.fix, like node: ^16. But if a user needs to define a specific version he can do in using volta prop. In the first case we don't need to duplicate the info about tool version.
  • In some cases a user can use volta to work with a project, but other team mates don't. In this case commiting volta prop to package.json is redundant and might be declined on a code review

barinbritva avatar Jan 19 '23 06:01 barinbritva

This sounds as an good idea on first sense, but will lead to a breaking changes and unexpected behaviour for users who already using global node for some reason. Second issue with semver of such records, e.b. node: ^16 may not work with volta, as it expects exact version

mufasa71 avatar Jan 24 '23 22:01 mufasa71

While there were a couple of discussions about the usage of the engines field (#355, for example), in the latest Node versions there's an experimental corepack tool Volta can leverage for setting and referring to the current package manager and its version.

Moshyfawn avatar Feb 08 '23 04:02 Moshyfawn

This sounds as an good idea on first sense, but will lead to a breaking changes and unexpected behaviour for users who already using global node for some reason. Second issue with semver of such records, e.b. node: ^16 may not work with volta, as it expects exact version

This have a very easy solution, if volta find the volta json configuration node, volta will give priority to that configuration.

As I said, It's a shame that you're not considering the proposal, it would be a great addition to Volta. I love Volta, and whenever I manage a project, I always add Volta configuration to my package.json. However, when I collaborate on a project, they usually don't want anything unofficial added to the package.json configuration, so most of the time, I can't use Volta.

kenny-reyes avatar Apr 08 '25 10:04 kenny-reyes