Open akineko opened 5 months ago
If npm could be made a symbolic link
the problem with this is that it's currently a shim that automatically runs mise reshim
when global packages are installed so we can't really get rid of that.
I really like mise's reframing of "legacy version files" to "idiomatic" version files.
Where asdf's framing was focused entirely on compatibility (and wasn't forward-looking at all), the "idiomatic" framing seems to open the door to adding support for newer ecosystem idioms.
Since corepack has become the Node ecosystem standard for communicating Node-specific tools via package.json
, it would be awesome if Mise added support for corepack
. This could be accomplished either by interpreting the package.json
declaration as an "idiomatic" version file.
Integrating directly with the corepack
workflow would also be awesome, but that's harder and I think we could get a lot of mileage from simply interpreting the fields used by corepack.
As an aside, I never understood why
asdf
doesn't already treatengines
inpackage.json
as a source of idiomatic version information. I'm a noob to this space and there's probably an obvious reason.
Since corepack has become the Node ecosystem standard for communicating Node-specific tools via package.json, it would be awesome if Mise added support for corepack. This could be accomplished either by interpreting the package.json declaration as an "idiomatic" version file.
It's not clear what this means practically, is it essentially just that we would run corepack enable [packagemanager.name] && corepack install [packagemanager.name]@[packagemanager.version]
when installing node?
I think we could do this, however I am a bit concerned with presenting this to the user as it has a limitation with what would be possible today without significant changes. mise does support "tool options" which seems like the best place to add this metadata, these modify what happens when tools are installed, e.g.:
[tools]
node = {version="20", corepack="pnpm@1"}
The trouble here is this affects all installations of node@20
. So if you had another project with this configuration:
[tools]
node = {version="20", corepack="yarn@1"}
Then yarn wouldn't necessarily be used in the case you installed the one with the pnpm config first.
Of course this problem isn't limited to node, but right now we barely used this feature in mise so it hasn't been an issue but if we added corepack it would get used a lot more heavily.
One solution to this would be for project tools to be installed locally to a .mise
directory inside the project like node_modules
, but that would be a pretty major change to mise with its own set of drawbacks.
Thank you for the excellent tool. I'm not good at English, so the text might be difficult to read. Please understand.
Background
Corepack has a feature that throws an error when a different tool than the one specified in the
packageManager
field ofpackage.json
is used. This feature does not work with Node.js installed by mise.package.json
yarn install
failed.But,
npm install
succeeds.Other run results.
Proposal
If
npm
could be made a symbolic link, similar tonpx
, I predict thatcorepack enable npm
would become usable and the issue would be resolved.