Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

volta pin command should also update package.engines.yarn if present #841

Closed
micahstubbs opened this issue Sep 23, 2020 · 3 comments
Closed

Comments

@micahstubbs
Copy link

volta pin command should also update package.engines.yarn if present

reasoning: as a user of volta, when I run the command volta pin yarn@latest in my project, I have to manually update the package.engines.yarn field as well.

It would be more ergonomic if volta would just update this field as well for me, or at least present some cli dialog prompt asking me if I want to package.engines.yarn as well.

@micahstubbs
Copy link
Author

another option would be to detect that the package.engines.yarn field is set when a user runs volta setup and explain to the user that using package.engines.yarn and volta together is not recommended.

@micahstubbs
Copy link
Author

micahstubbs commented Sep 23, 2020

either way, whether the the volta tool helps me upgrade all my config in sync or whether it tells me not to use potentially conflicting config, I feel like volta should be smart enough to anticipate this inconsistent config state (two different versions of yarn specified in my package.json) and help me the user avoid it 😄

@charlespierce
Copy link
Contributor

We actually discussed this a fair amount early on in the project and ultimately decided against re-using or interacting with engines at all. The reason for that is that they represent two conceptually different (though similar) things:

  • engines represents the range of versions that your package works under. It's used by consumers of your package to determine if their environment is consistent or not (e.g. npm will throw an error if you attempt to install a package using a Node version that is incompatible with the package's engines key).
  • volta represents the specific versions that are used in developing and building your package. It's used by developers of your package to ensure that everyone has the same environment when working on the package.

engines should be set to the widest possible range that your library supports, to ensure compatibility with the highest number of consumers, while volta must be set to specific versions (no wildcards / ranges), to ensure that the environment is repeatable. Given that, I'm not sure if there's a way for Volta to meaningfully interact with engines, since there's no way for us to know the full spread of possible versions that your library supports (or doesn't support).

For some more discussion of engines, see #742 and #355

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

No branches or pull requests

2 participants