-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
363 additions
and
103 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
# ALIAS Command - Node Version Switcher | ||
``` | ||
nvs alias | ||
nvs alias <name> | ||
nvs alias <name> <version> | ||
nvs alias <name> <directory> | ||
nvs alias -d <name> | ||
``` | ||
|
||
nvs alias | ||
nvs alias <name> | ||
nvs alias <name> <version> | ||
nvs alias <name> <directory> | ||
nvs alias -d <name> | ||
|
||
Queries, sets, or removes version aliases. When no arguments are specified, all alias names and values are listed. When just a name is specified, the value for that alias is shown, if it exists. When a name and value are specified, the alias is added or updated to the persisted list. The `-d` switch removes an item. The alias settings are persisted in `$NVS_HOME/settings.json`. | ||
|
||
An alias may refer to a combination of a remote name and a semantic version. (Processor architectures are not aliased.) When setting an alias, the remote name may be omitted, in which case the alias refers to the default remote. For example `nvs alias 6.7.0` is exactly equivalent to `nvs alias default/6.7.0`. | ||
|
||
When using an alias with other commands, a processor architecture may be optionally appended to override the system default, the same as with semantic versions. For example: | ||
``` | ||
$ nvs alias myalias 6.7.0 | ||
$ nvs alias | ||
myalias default/6.7.0 | ||
$ nvs run myalias --version | ||
v6.7.0 | ||
$ nvs which myalias | ||
~/.nvs/node/6.7.0/x64/bin/node | ||
$ nvs which myalias/32 | ||
~/.nvs/node/6.7.0/x86/bin/node | ||
``` | ||
|
||
$ nvs alias myalias 6.7.0 | ||
$ nvs alias | ||
myalias default/6.7.0 | ||
$ nvs run myalias --version | ||
v6.7.0 | ||
$ nvs which myalias | ||
~/.nvs/node/6.7.0/x64/bin/node | ||
$ nvs which myalias/32 | ||
~/.nvs/node/6.7.0/x86/bin/node | ||
|
||
## Aliasing directories | ||
|
||
An alias may also refer to a local directory containing any node executable. Create an alias like this to enable NVS to switch to/from a version of node that was built locally from source: | ||
``` | ||
$ nvs alias dev ~/src/node/out/Release | ||
$ nvs use dev | ||
PATH += ~/src/node/out/Release | ||
$ nvs ls | ||
#node/6.9.1/x64 | ||
>/home/username/src/node/out/Release (dev) | ||
$ nvs use lts | ||
PATH -= ~/src/node/out/Release | ||
PATH += ~/.nvs/node/6.9.1/x64/bin | ||
``` | ||
|
||
$ nvs alias dev ~/src/node/out/Release | ||
$ nvs use dev | ||
PATH += ~/src/node/out/Release | ||
$ nvs ls | ||
#node/6.9.1/x64 | ||
>/home/username/src/node/out/Release (dev) | ||
$ nvs use lts | ||
PATH -= ~/src/node/out/Release | ||
PATH += ~/.nvs/node/6.9.1/x64/bin | ||
|
||
Note it is not possible to `nvs use` a directory without using an alias. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# EXEC Command - Node Version Switcher | ||
``` | ||
nvs exec <version> <exe> [args...] | ||
``` | ||
|
||
nvs exec <version> <exe> [args...] | ||
|
||
Runs any executable using a `PATH` environment that includes the specified node version, without changing the caller's `PATH`. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# LIST-REMOTE Command - Node Version Switcher | ||
``` | ||
nvs lsr [filter] | ||
nvs ls-remote [filter] | ||
nvs list-remote [filter] | ||
``` | ||
|
||
nvs lsr [filter] | ||
nvs ls-remote [filter] | ||
nvs list-remote [filter] | ||
|
||
Lists node versions available to download. | ||
|
||
The optional filter parameter may be a configured remote name, or a partial semantic version such as `6.5`, or a remote name and partial version such as `node/6`. If the filter is or includes a remote name, then available versions from that remote are listed; otherwise versions from the default remote are listed. A remote name is one of the keys from the `remotes` mapping in `$NVS_HOME/settings.json`. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# MIGRATE Command - Node Version Switcher | ||
``` | ||
nvs migrate <sourceversion> [targetversion] | ||
``` | ||
|
||
nvs migrate <sourceversion> [targetversion] | ||
|
||
Migrates globally-installed and globally-linked modules from a source node version to a target node version. Note this ignores any configuration (NPM_CONFIG_PREFIX environment variable or prefix setting in the user's npmrc) that might override the global modules directory location, because that configuration would apply apply to both versions and therefore no migration would be necessary or possible. | ||
|
||
The source and target versions must refer to previously-added node versions. The target version optional; if unspecified then the currently used version is the target. |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# RUN Command - Node Version Switcher | ||
``` | ||
nvs <module.js> [args...] | ||
nvs run <module.js> [args...] | ||
nvs run auto <module.js> [args...] | ||
nvs <version> <module.js> [args...] | ||
nvs run <version> <module.js> [args...] | ||
``` | ||
|
||
nvs <module.js> [args...] | ||
nvs run <module.js> [args...] | ||
nvs run auto <module.js> [args...] | ||
|
||
nvs <version> <module.js> [args...] | ||
nvs run <version> <module.js> [args...] | ||
|
||
Runs a node module using a specified node version, without changing the caller's `PATH`. | ||
|
||
If no version (or "auto") is specified, NVS searches for the nearest `.node-version` file in the current directory or parent directories. If found, the version specified in the file is then downloaded (if necessary) and used to run the module. If no `.node-version` file is found, then the current version of node is used to run the module; if there is no current version then the default (linked) version, if any, is used to run the module. |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# UNLINK Command - Node Version Switcher | ||
``` | ||
nvs unlink [version] | ||
nvs ul [version] | ||
``` | ||
|
||
nvs unlink [version] | ||
nvs ul [version] | ||
|
||
Removes a symbolic directory link if it exists at `$NVS_HOME/default`. If a version is specified, then the link is only removed if it points to that version. | ||
|
||
On Windows, this command also removes the default (linked) version from the profile `PATH` environment variable. Afterward, new shell windows will not use any Node.js version. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# UPGRADE Command - Node Version Switcher | ||
|
||
nvs upgrade [fromversion] | ||
|
||
Upgrades the specified Node version to the latest available build with the same major version. If no version is specified, the version currently in use is implied, if any. | ||
|
||
## Upgrade procedure | ||
The following steps are performed automatically by the upgrade command: | ||
|
||
1. Query the remote to identify the latest available version with the same major version as the specified version. | ||
2. Download and install (`nvs add`) the newer version, if not already added. | ||
3. Migrate global packages (`nvs migrate`) from the old to the new version. | ||
4. If the old version was linked, link (`nvs link`) the new version instead. | ||
5. Use (`nvs use`) the new version if the old version was previously in use. | ||
6. Remove the old version. | ||
|
||
## Examples | ||
|
||
nvs add lts # Adds 6.10.1 | ||
# Some time later 6.10.2 is published | ||
nvs use lts # Uses 6.10.1 (nvs use does not check for a newer version) | ||
nvs upgrade # Upgrades from 6.10.1 to 6.10.2 | ||
|
||
nvs add argon # Adds 4.8.1 | ||
# Some time later 4.9.0 is published | ||
nvs upgrade argon # Upgrades from 4.8.1 to 4.9.0 | ||
|
||
nvs add 7.7 # Adds 7.7.4 | ||
nvs add 7 # Adds 7.8.0... forgot to use the upgrade command | ||
nvs upgrade 7.7 # Upgrades from 7.7.4 to 7.8.0 | ||
|
||
nvs add nightly # Adds the latest build from the "nightly" remote: 8.0.0-nightly20170331... | ||
# One day later | ||
nvs upgrade nightly # Upgrades from 8.0.0-nightly20170331... to 8.0.0-nightly20170401... |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# WHICH Command - Node Version Switcher | ||
``` | ||
nvs which [version] | ||
``` | ||
|
||
nvs which [version] | ||
|
||
Shows the path to a specified local node version, or the current version in the PATH if a version is not specified. |
This file contains 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
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.