-
-
Notifications
You must be signed in to change notification settings - Fork 6
Description
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 node 10.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
or 0.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.