-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
nodenv support of partial version #1
Comments
Thanks. I'm not sure yet what I'll try covering with the feature table. I am leaning towards only features that are fairly widely supported across the products and have not filled out the table enough to see.
This raises another implementation difference though. If a product supports partial matching, is it matching against the already installed versions or against the versions available from nodejs? Partial version might have too many variations to make it worth covering at all! Work in progress... |
I agree that the partial support should only be something that is compatible with other version managers.
With all the discussion that already took place it would already be a major achievement if the non partial version can be "unified". After that we can talk about the compatibility of the different options of partial versions... But it's of course helpful to know about the flexibility nodenv offers to basically configure on your machine what each "version" should point to (which of course also means it can mean something completely different from what it means on some other machine). |
Finished survey. I am actually slightly surprised by the wide support for partial (fuzzy) versions for
Feel free to close @jasonkarns , but welcome to leave open for more comments. Thanks @jasonkarns and @karfau . |
nodenv sorta supports partial version strings.
Nodenv's .node-version doesn't perform any logic or computation around the contents of the .node-version file. (other than attempting to match with & without the leading
v
prefix) It takes the version string from the file, and "blindly" uses it as the version to activate; and since versions are found by their directory name within$(nodenv root)/versions/
, then nodenv will happily activate node10.2
if there exists an installed node with that name. (ie,$(nodenv root)/versions/10.2/bin/node
)This also works with any text string. Back in the day when npm2 vs npm3 compatibility was a major pain, many nodenv users would duplicate node installations such that one was pinned to npm2 and another with npm3.
$(nodenv root)/versions/0.10.8-npm2/
$(nodenv root)/versions/0.10.8-npm3/
Which would expect a .node-version file containing either
0.10.8-npm2
or0.10.8-npm3
.Intelligent partial matching
So strictly speaking nodenv, does support partial version matching. However, it doesn't support it in the likely-common expectation that the partial version will intelligently match a corresponding node named with the full version string.
This intelligent partial matching can be accomplished with symlinks. A symlink with the partial version name is created, pointing to the full version node:
ie
$(nodenv root)/versions/10.2 => $(nodenv root)/versions/10.2.4
With that symlink in place, a .node-version file containing just
10.2
works as expected.Further, in order to get "automatic" symlink creation/deletion/updating, the nodenv-aliases plugin can be used.
TL;DR
So in summary, I understand that it's probably not useful to give nodenv a full ✅ for partial string support; but ❌ is also not quite accurate. Users can use partial version strings (or quite literally, any string) and nodenv will activate the same-named node on their system. And symlinks can be used to enhance fuzzy matching.
The text was updated successfully, but these errors were encountered: