-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Contributing support for reading nodejs version from package.json #7211
Description
Contribution
- I'd be willing to implement this feature (contributing guide)
Describe the user story
I want to contribute support for reading nodejs version from package.json, since that is what we use to tell Heroku which nodejs version to use on our production server.
Example:
"engines": {
"node": "18"
},package.json
Describe the solution you'd like
By making changes to https://github.com/pnpm/pnpm/blob/main/config/config/src/index.ts, I hope to be able to implement reading from the standard engines section in package.json and set the nodejs version configuration accordingly.
Perhaps I will utilise node.resolver, if reasonable. The implementation will have to be semver aware and be able to handle greater-/less-than nodejs versions.
I would also like the implementation to be aware of an already installed nodejs version.
However, I think it is out of scope to support the myriads of nodejs managers in the wild. So my implementation will only look at what is currently installed.
Describe the drawbacks of your solution
None is currently known. I have made https://github.com/orgs/pnpm/discussions/7205, to ask everyone if there is any known drawbacks and after more than 24 hours, no one came up with anything.
Describe alternatives you've considered
The current solution is to create an .npmrc file, which specify nodejs version. I'm not a fan of even more configuration files. Especially not, since we already got one place that we edit to specify nodejs version. Having multiple places, will eventually lead to errors.