Closed g4rcez closed 2 weeks ago
I suggested implementing prehooks to parse the version from an output of the script, but for specific node stuff, I did PR #2288.
I feel strongly this is not a good idea. That field denotes compatibility, it should not be used to determine the ultimate version of node.
There is a thread for nvm that discusses this topic in-depth: https://github.com/nvm-sh/nvm/issues/651
I've had this debate with many people over the years and my mind is made up so I won't be discussing it further.
Context
Some NodeJS/Javascript projects have the attribute
engines
in package.json. That enforces the version of NodeJS in the project. Ref: https://docs.npmjs.com/cli/v10/configuring-npm/package-json#enginesCan mise parse the package.json files to grab the version from
engines.node
?Possible solutions
Accept a hook before setting the version of NodeJS.
File: ~/.bin/node-pre-hook
With this solution, we can enable custom hooks to accept any custom methods to accept configuration
Motivation
I was using volta and all my projects use
volta.node
at package.json. This motivates me to configure volta projects to work with miseI'm trying to do this just using zsh prehooks and I will share at this issue if I can get it.