feat: support partial Node version resolution - #81
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Close 1111mp/nvm-desktop#359
This PR adds Node version resolution support, allowing users to specify partial Node versions and automatically match the latest installed version.
Previously,
nvmdonly supported exact version matching:With this change, users can specify a major or minor version:
and
nvmdwill automatically resolve it to the latest installed matching version.Changes
NodeVersionResolverfor Node version parsing and resolution14→ latest installed14.x.x14.18→ latest installed14.18.x14.18.3→ exact version matchvprefix in version input:v14v14.18.3Examples
Assume the following Node versions are installed:
Major version matching
Command:
Resolved version:
Major and minor version matching
Command:
Resolved version:
Exact version matching
Command:
Resolved version:
Motivation
This change makes
nvmdversion selection more flexible and closer to the behavior of other Node version managers.Users no longer need to remember or specify the exact patch version when switching Node versions. They can simply specify the major or minor version they need, and
nvmdwill select the latest installed compatible version automatically.Implementation Details
NodeVersionRequestto represent different version requirements:Testing
Tested the following scenarios:
vprefix version input