Merge pull request #1070 from ljharb/display_lts_remote

[New] Add remote LTS support
Jordan Harband 2016-07-20 00:22:29 -07:00 committed by GitHub
commit dbb65d98c2
33 changed files with 1377 additions and 125 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ alias
test/bak
.urchin.log
.urchin_stdout
test/**/test_output
node_modules/
npm-debug.log

View File

@ -28,7 +28,7 @@ Note: On OS X, if you have/had a "system" node installed and want to install mod
- If you have an `~/.npmrc` file, make sure it does not contain any `prefix` settings (which is not compatible with nvm)
- You can (but should not?) keep your previous "system" node install, but nvm will only be available to your user account (the one used to install nvm). This might cause version mismatches, as other users will be using `/usr/local/lib/node_modules/*` VS your user account using `~/.nvm/versions/node/vX.X.X/lib/node_modules/*`
Homebrew installation is not supported.
Homebrew installation is not supported. If you have issues with homebrew-installed `nvm`, please `brew uninstall` it, and install it using the instructions below, before filing an issue.
Note: If you're using `zsh` you can easily install `nvm` as a zsh plugin. Install [`zsh-nvm`](https://github.com/lukechilds/zsh-nvm) and run `nvm_update` to update.
@ -112,22 +112,22 @@ After upgrading, don't forget to activate the new version:
## Usage
To download, compile, and install the latest v5.0.x release of node, do this:
To download, compile, and install the latest release of node, do this:
```sh
nvm install 5.0
nvm install node
```
And then in any new shell just use the installed version:
```sh
nvm use 5.0
nvm use node
```
Or you can just run it:
```sh
nvm run 5.0 --version
nvm run node --version
```
Or, you can run any arbitrary command in a subshell with the desired version of node:
@ -148,6 +148,19 @@ In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the f
- `stable`: this alias is deprecated, and only truly applies to `node` `v0.12` and earlier. Currently, this is an alias for `node`.
- `unstable`: this alias points to `node` `v0.11` - the last "unstable" node release, since post-1.0, all node versions are stable. (in semver, versions communicate breakage, not stability).
### Long-term support
Node has a [schedule](https://github.com/nodejs/LTS#lts_schedule) for long-term support (LTS) You can reference LTS versions in aliases and `.nvmrc` files with the notation `lts/*` for the latest LTS, and `lts/argon` for LTS releases from the "argon" line, for example. In addition, the following commands support LTS arguments:
- `nvm install --lts` / `nvm install --lts=argon`
- `nvm uninstall --lts` / `nvm uninstall --lts=argon`
- `nvm use --lts` / `nvm use --lts=argon`
- `nvm exec --lts` / `nvm exec --lts=argon`
- `nvm run --lts` / `nvm run --lts=argon`
- `nvm ls-remote --lts` / `nvm ls-remote --lts=argon`
- `nvm version-remote --lts` / `nvm version-remote --lts=argon`
Any time your local copy of `nvm` connects to https://nodejs.org, it will re-create the appropriate local aliases for all available LTS lines. These aliases (stored under `$NVM_DIR/alias/lts`), are managed by `nvm`, and you should not modify, remove, or create these files - expect your changes to be undone, and expect meddling with these files to cause bugs that will likely not be supported.
### Migrating global packages while installing
If you want to install a new version of Node.js and migrate npm packages from a previous version:
```sh
@ -159,10 +172,11 @@ This will first use "nvm version node" to identify the current version you're mi
You can also install and migrate npm packages from specific versions of Node like this:
```sh
nvm install v5.0 --reinstall-packages-from=4.2
nvm install 6 --reinstall-packages-from=5
nvm install v4.2 --reinstall-packages-from=iojs
```
### io.js
If you want to install [io.js](https://github.com/iojs/io.js/):
```sh
@ -177,6 +191,7 @@ nvm install iojs --reinstall-packages-from=iojs
The same guidelines mentioned for migrating npm packages in Node.js are applicable to io.js.
### System version of node
If you want to use the system-installed version of node, you can use the special default alias "system":
```sh
@ -184,6 +199,7 @@ nvm use system
nvm run system --version
```
### Listing versions
If you want to see what versions are installed:
```sh
@ -217,7 +233,7 @@ nvm install node
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist nvm install 4.2
```
To use a mirror of the iojs binaries, set `$NVM_IOJS_ORG_MIRROR`:
To use a mirror of the io.js binaries, set `$NVM_IOJS_ORG_MIRROR`:
```sh
export NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
@ -226,7 +242,7 @@ nvm install iojs-v1.0.3
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist nvm install iojs-v1.0.3
```
`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs.
`nvm use` will not, by default, create a "current" symlink. Set `$NVM_SYMLINK_CURRENT` to "true" to enable this behavior, which is sometimes useful for IDEs. Note that using `nvm` in multiple shell tabs with this environment variable enabled can cause race conditions.
### .nvmrc
@ -237,6 +253,8 @@ For example, to make nvm default to the latest 5.9 release for the current direc
```sh
$ echo "5.9" > .nvmrc
$ echo "lts/*" > .nvmrc # to default to the latest LTS version
```
Then when you run nvm:
@ -280,7 +298,7 @@ load-nvmrc
nvm is released under the MIT license.
Copyright (C) 2010-2016 Tim Caswell
Copyright (C) 2010-2016 Tim Caswell and Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -57,9 +57,9 @@ __nvm_aliases ()
declare aliases
aliases=""
if [ -d $NVM_DIR/alias ]; then
aliases="`cd $NVM_DIR/alias && command ls`"
aliases="$(cd $NVM_DIR/alias && find $PWD -type f | sed "s:$PWD/::")"
fi
echo "${aliases}"
echo "${aliases} node stable unstable iojs"
}
__nvm_alias ()

340
nvm.sh
View File

@ -308,16 +308,23 @@ nvm_remote_version() {
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
case "_$PATTERN" in
"_$(nvm_iojs_prefix)")
VERSION="$(nvm_ls_remote_iojs | command tail -1)"
VERSION="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote_iojs | command tail -1)"
;;
*)
VERSION="$(nvm_ls_remote "$PATTERN")"
VERSION="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "$PATTERN")"
;;
esac
else
VERSION="$(nvm_remote_versions "$PATTERN" | command tail -1)"
VERSION="$(NVM_LTS="${NVM_LTS-}" nvm_remote_versions "$PATTERN" | command tail -1)"
fi
if [ -n "${NVM_VERSION_ONLY-}" ]; then
command awk 'BEGIN {
n = split(ARGV[1], a);
print a[1]
}' "${VERSION}"
else
nvm_echo "${VERSION}"
fi
nvm_echo "$VERSION"
if [ "_$VERSION" = '_N/A' ]; then
return 3
fi
@ -330,18 +337,18 @@ nvm_remote_versions() {
PATTERN="$1"
case "_$PATTERN" in
"_$NVM_IOJS_PREFIX" | "_io.js")
VERSIONS="$(nvm_ls_remote_iojs)"
VERSIONS="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote_iojs)"
;;
"_$(nvm_node_prefix)")
VERSIONS="$(nvm_ls_remote)"
VERSIONS="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote)"
;;
*)
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
nvm_err 'Implicit aliases are not supported in nvm_remote_versions.'
return 1
fi
VERSIONS="$(nvm_echo "$(nvm_ls_remote "$PATTERN")
$(nvm_ls_remote_iojs "$PATTERN")" | nvm_grep -v "N/A" | command sed '/^$/d')"
VERSIONS="$(nvm_echo "$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "$PATTERN")
$(NVM_LTS=${NVM_LTS-} nvm_ls_remote_iojs "$PATTERN")" | nvm_grep -v "N/A" | command sed '/^$/d')"
;;
esac
@ -484,11 +491,17 @@ nvm_print_formatted_alias() {
DEST_FORMAT='\033[1;31m%s\033[0m'
VERSION_FORMAT='\033[1;31m%s\033[0m'
fi
if [ "_${NVM_LTS-}" = '_true' ]; then
ALIAS_FORMAT='\033[1;33m%s\033[0m'
fi
if [ "_${DEST%/*}" = "_lts" ]; then
DEST_FORMAT='\033[1;33m%s\033[0m'
fi
fi
if [ "_$DEST" = "_$VERSION" ]; then
command printf "${ALIAS_FORMAT} ${ARROW} ${VERSION_FORMAT}${NEWLINE}" "$ALIAS" "$DEST"
command printf -- "${ALIAS_FORMAT} ${ARROW} ${VERSION_FORMAT}${NEWLINE}" "$ALIAS" "$DEST"
else
command printf "${ALIAS_FORMAT} ${ARROW} ${DEST_FORMAT} (${ARROW} ${VERSION_FORMAT})${NEWLINE}" "$ALIAS" "$DEST" "$VERSION"
command printf -- "${ALIAS_FORMAT} ${ARROW} ${DEST_FORMAT} (${ARROW} ${VERSION_FORMAT})${NEWLINE}" "$ALIAS" "$DEST" "$VERSION"
fi
}
@ -510,7 +523,7 @@ nvm_print_alias_path() {
local DEST
DEST="$(nvm_alias "$ALIAS" 2> /dev/null || return 0)"
if [ -n "$DEST" ]; then
DEFAULT=false nvm_print_formatted_alias "$ALIAS" "$DEST"
NVM_LTS="${NVM_LTS-}" DEFAULT=false nvm_print_formatted_alias "$ALIAS" "$DEST"
fi
}
@ -597,7 +610,7 @@ nvm_resolve_alias() {
local SEEN_ALIASES
SEEN_ALIASES="$ALIAS"
while true; do
ALIAS_TEMP="$(nvm_alias "$ALIAS" 2> /dev/null)"
ALIAS_TEMP="$(nvm_alias "$ALIAS" 2> /dev/null || echo)"
if [ -z "$ALIAS_TEMP" ]; then
break
@ -845,20 +858,22 @@ nvm_ls_remote() {
local PATTERN
PATTERN="$1"
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
PATTERN="$(nvm_ls_remote "$(nvm_print_implicit_alias remote "$PATTERN")" | command tail -1)"
PATTERN="$(NVM_LTS="${NVM_LTS-}" nvm_ls_remote "$(nvm_print_implicit_alias remote "$PATTERN")" | command awk '{ print $1 }' | command tail -1)"
elif [ -n "$PATTERN" ]; then
PATTERN="$(nvm_ensure_version_prefix "$PATTERN")"
else
PATTERN=".*"
fi
nvm_ls_remote_index_tab node std "$NVM_NODEJS_ORG_MIRROR" "$PATTERN"
NVM_LTS="${NVM_LTS-}" nvm_ls_remote_index_tab node std "$NVM_NODEJS_ORG_MIRROR" "$PATTERN"
}
nvm_ls_remote_iojs() {
nvm_ls_remote_index_tab iojs std "$NVM_IOJS_ORG_MIRROR" "$1"
NVM_LTS="${NVM_LTS-}" nvm_ls_remote_index_tab iojs std "$NVM_IOJS_ORG_MIRROR" "$1"
}
nvm_ls_remote_index_tab() {
local LTS
LTS="${NVM_LTS-}"
if [ "$#" -lt 4 ]; then
nvm_err 'not enough arguments'
return 5
@ -896,19 +911,52 @@ nvm_ls_remote_index_tab() {
PATTERN="$(nvm_ensure_version_prefix "$PATTERN")"
fi
else
PATTERN=".*"
unset PATTERN
fi
ZSH_HAS_SHWORDSPLIT_UNSET=1
if nvm_has "setopt"; then
ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit
fi
VERSIONS="$(nvm_download -L -s "$MIRROR/index.tab" -o - \
local VERSION_LIST
VERSION_LIST="$(nvm_download -L -s "$MIRROR/index.tab" -o - \
| command sed "
1d;
s/^/$PREFIX/;
s/[[:blank:]].*//" \
| nvm_grep -w "$PATTERN" \
" \
)"
local LTS_ALIAS
local LTS_VERSION
nvm_echo "$VERSION_LIST" \
| awk '{
if ($10 ~ /^\-?$/) { next }
if ($10 && !a[tolower($10)]++) {
if (alias) { print alias, version }
alias = "lts/" tolower($10)
version = $1
}
}
END {
if (alias) {
print alias, version
print "lts/*", alias
}
}' \
| while read -r LTS_ALIAS_LINE; do
LTS_ALIAS="${LTS_ALIAS_LINE%% *}"
LTS_VERSION="${LTS_ALIAS_LINE#* }"
nvm_make_alias "$LTS_ALIAS" "$LTS_VERSION" >/dev/null 2>&1
done
VERSIONS="$(nvm_echo "$VERSION_LIST" \
| command awk -v pattern="${PATTERN-}" -v lts="${LTS-}" '{
if (!$1) { next }
if (pattern && tolower($1) !~ tolower(pattern)) { next }
if (lts == "*" && $10 ~ /^\-?$/) { next }
if (lts && lts != "*" && tolower($10) !~ tolower(lts)) { next }
if ($10 !~ /^\-?$/) print $1, $10; else print $1
}' \
| nvm_grep -w "${PATTERN:-.*}" \
| $SORT_COMMAND)"
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
unsetopt shwordsplit
@ -968,6 +1016,7 @@ nvm_checksum() {
nvm_print_versions() {
local VERSION
local LTS
local FORMAT
local NVM_CURRENT
NVM_CURRENT=$(nvm_ls_current)
@ -975,26 +1024,57 @@ nvm_print_versions() {
if nvm_has_colors; then
NVM_HAS_COLORS=1
fi
nvm_echo "$1" | while read -r VERSION; do
FORMAT='%15s'
local LTS_LENGTH
local LTS_FORMAT
nvm_echo "$1" \
| command sed '1!G;h;$!d' \
| command awk '{ if ($2 && a[$2]++) { print $1, "(LTS: " $2 ")" } else if ($2) { print $1, "(Latest LTS: " $2 ")" } else { print $0 } }' \
| command sed '1!G;h;$!d' \
| while read -r VERSION_LINE; do
VERSION="${VERSION_LINE%% *}"
LTS="${VERSION_LINE#* }"
FORMAT='%15s '
if [ "_$VERSION" = "_$NVM_CURRENT" ]; then
if [ "${NVM_HAS_COLORS-}" = '1' ]; then
FORMAT='\033[0;32m-> %12s\033[0m'
FORMAT='\033[0;32m-> %12s\033[0m '
else
FORMAT='-> %12s *'
fi
elif [ "$VERSION" = "system" ]; then
if [ "${NVM_HAS_COLORS-}" = '1' ]; then
FORMAT='\033[0;33m%15s\033[0m'
FORMAT='\033[0;33m%15s\033[0m '
fi
elif nvm_is_version_installed "$VERSION"; then
if [ "${NVM_HAS_COLORS-}" = '1' ]; then
FORMAT='\033[0;34m%15s\033[0m'
FORMAT='\033[0;34m%15s\033[0m '
else
FORMAT='%15s *'
fi
fi
command printf -- "$FORMAT\n" "$VERSION"
if [ "${LTS}" != "${VERSION}" ]; then
case "${LTS}" in
*Latest*)
LTS="${LTS##Latest }"
LTS_LENGTH="${#LTS}"
if [ "${NVM_HAS_COLORS-}" = '1' ]; then
LTS_FORMAT="\033[1;32m%${LTS_LENGTH}s\033[0m"
else
LTS_FORMAT="%${LTS_LENGTH}s"
fi
;;
*)
LTS_LENGTH="${#LTS}"
if [ "${NVM_HAS_COLORS-}" = '1' ]; then
LTS_FORMAT="\033[0;37m%${LTS_LENGTH}s\033[0m"
else
LTS_FORMAT="%${LTS_LENGTH}s"
fi
;;
esac
command printf -- "${FORMAT}${LTS_FORMAT}\n" "$VERSION" " $LTS"
else
command printf -- "${FORMAT}\n" "$VERSION"
fi
done
}
@ -1757,17 +1837,32 @@ nvm() {
nvm_echo ' nvm --version Print out the latest released version of nvm'
nvm_echo ' nvm install [-s] <version> Download and install a <version>, [-s] from source. Uses .nvmrc if available'
nvm_echo ' --reinstall-packages-from=<version> When installing, reinstall packages installed in <node|iojs|node version number>'
nvm_echo ' --lts When installing, only select from LTS (long-term support) versions'
nvm_echo ' --lts=<LTS name> When installing, only select from versions for a specific LTS line'
nvm_echo ' nvm uninstall <version> Uninstall a version'
nvm_echo ' nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.'
nvm_echo ' nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.'
nvm_echo ' nvm use [--silent] <version> Modify PATH to use <version>. Uses .nvmrc if available'
nvm_echo ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
nvm_echo ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
nvm_echo ' nvm exec [--silent] <version> [<command>] Run <command> on <version>. Uses .nvmrc if available'
nvm_echo ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
nvm_echo ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
nvm_echo ' nvm run [--silent] <version> [<args>] Run `node` on <version> with <args> as arguments. Uses .nvmrc if available'
nvm_echo ' --lts Uses automatic LTS (long-term support) alias `lts/*`, if available.'
nvm_echo ' --lts=<LTS name> Uses automatic alias for provided LTS line, if available.'
nvm_echo ' nvm current Display currently activated version'
nvm_echo ' nvm ls List installed versions'
nvm_echo ' nvm ls <version> List versions matching a given description'
nvm_echo ' nvm ls <version> List versions matching a given <version>'
nvm_echo ' nvm ls-remote List remote versions available for install'
nvm_echo ' --lts When listing, only show LTS (long-term support) versions'
nvm_echo ' nvm ls-remote <version> List remote versions available for install, matching a given <version>'
nvm_echo ' --lts When listing, only show LTS (long-term support) versions'
nvm_echo ' --lts=<LTS name> When listing, only show versions for a specific LTS line'
nvm_echo ' nvm version <version> Resolve the given description to a single local version'
nvm_echo ' nvm version-remote <version> Resolve the given description to a single remote version'
nvm_echo ' --lts When listing, only select from LTS (long-term support) versions'
nvm_echo ' --lts=<LTS name> When listing, only select from versions for a specific LTS line'
nvm_echo ' nvm deactivate Undo effects of `nvm` on current shell'
nvm_echo ' nvm alias [<pattern>] Show all aliases beginning with <pattern>'
nvm_echo ' nvm alias <name> <version> Set an alias named <name> pointing to <version>'
@ -1826,17 +1921,13 @@ nvm() {
if [ $# -lt 2 ]; then
version_not_provided=1
nvm_rc_version
if [ -z "$NVM_RC_VERSION" ]; then
>&2 nvm --help
return 127
fi
fi
shift
local nobinary
nobinary=0
local LTS
while [ $# -ne 0 ]
do
case "$1" in
@ -1849,6 +1940,14 @@ nvm() {
nvm_get_make_jobs "$1"
shift # consume job count
;;
--lts)
LTS='*'
shift
;;
--lts=*)
LTS="${1##--lts=}"
shift
;;
*)
break # stop parsing args
;;
@ -1856,21 +1955,48 @@ nvm() {
done
local provided_version
provided_version="$1"
provided_version="${1-}"
if [ -z "$provided_version" ]; then
if [ $version_not_provided -ne 1 ]; then
if [ "_${LTS-}" = '_*' ]; then
nvm_echo 'Installing latest LTS version.'
if [ $# -gt 0 ]; then
shift
fi
elif [ "_${LTS-}" != '_' ]; then
nvm_echo "Installing with latest version of LTS line: $LTS"
if [ $# -gt 0 ]; then
shift
fi
else
nvm_rc_version
if [ $version_not_provided -eq 1 ]; then
if [ -z "$NVM_RC_VERSION" ]; then
>&2 nvm --help
return 127
fi
fi
provided_version="$NVM_RC_VERSION"
else
fi
elif [ $# -gt 0 ]; then
shift
fi
VERSION="$(nvm_remote_version "$provided_version")"
VERSION="$(NVM_VERSION_ONLY=true NVM_LTS="${LTS-}" nvm_remote_version "$provided_version")"
if [ "_$VERSION" = "_N/A" ]; then
nvm_err "Version '$provided_version' not found - try \`nvm ls-remote\` to browse available versions."
local LTS_MSG
local REMOTE_CMD
if [ "${LTS-}" = '*' ]; then
LTS_MSG='(with LTS filter) '
REMOTE_CMD='nvm ls-remote --lts'
elif [ -n "${LTS-}" ]; then
LTS_MSG="(with LTS filter '$LTS') "
REMOTE_CMD="nvm ls-remote --lts=${LTS}"
else
REMOTE_CMD='nvm ls-remote'
fi
nvm_err "Version '$provided_version' ${LTS_MSG-}not found - try \`${REMOTE_CMD}\` to browse available versions."
return 3
fi
@ -1917,7 +2043,11 @@ nvm() {
if nvm use "$VERSION" && [ ! -z "$REINSTALL_PACKAGES_FROM" ] && [ "_$REINSTALL_PACKAGES_FROM" != "_N/A" ]; then
nvm reinstall-packages "$REINSTALL_PACKAGES_FROM"
fi
if [ -n "${LTS-}" ]; then
nvm_ensure_default_set "lts/${LTS}"
else
nvm_ensure_default_set "$provided_version"
fi
return $?
fi
@ -1977,22 +2107,27 @@ nvm() {
return $?
;;
"uninstall" )
if [ $# -ne 2 ]; then
shift # remove "uninstall"
if [ $# -ne 1 ]; then
>&2 nvm --help
return 127
fi
local PATTERN
PATTERN="$2"
case "_$PATTERN" in
"_$(nvm_iojs_prefix)" | "_$(nvm_iojs_prefix)-" \
| "_$(nvm_node_prefix)" | "_$(nvm_node_prefix)-")
VERSION="$(nvm_version "$PATTERN")"
PATTERN="${1-}"
case "${PATTERN-}" in
--lts)
VERSION="$(nvm_match_version lts/*)"
;;
--lts=*)
VERSION="$(nvm_match_version lts/${PATTERN##--lts=})"
;;
*)
VERSION="$(nvm_version "$PATTERN")"
VERSION="$(nvm_version "${PATTERN}")"
;;
esac
if [ "_$VERSION" = "_$(nvm_ls_current)" ]; then
if nvm_is_iojs_version "$VERSION"; then
nvm_err "nvm: Cannot uninstall currently-active io.js version, $VERSION (inferred from $PATTERN)."
@ -2080,6 +2215,7 @@ nvm() {
NVM_USE_SILENT=0
local NVM_DELETE_PREFIX
NVM_DELETE_PREFIX=0
local NVM_LTS
shift # remove "use"
while [ $# -ne 0 ]
@ -2087,8 +2223,11 @@ nvm() {
case "$1" in
--silent) NVM_USE_SILENT=1 ;;
--delete-prefix) NVM_DELETE_PREFIX=1 ;;
--lts) NVM_LTS='*' ;;
--lts=*) NVM_LTS="${1##--lts=}" ;;
--*) ;;
*)
if [ -n "$1" ]; then
if [ -n "${1-}" ]; then
PROVIDED_VERSION="$1"
fi
;;
@ -2096,7 +2235,9 @@ nvm() {
shift
done
if [ -z "$PROVIDED_VERSION" ]; then
if [ -n "${NVM_LTS-}" ]; then
VERSION="$(nvm_match_version "lts/${NVM_LTS:-*}")"
elif [ -z "$PROVIDED_VERSION" ]; then
nvm_rc_version
if [ -n "$NVM_RC_VERSION" ]; then
PROVIDED_VERSION="$NVM_RC_VERSION"
@ -2137,7 +2278,7 @@ nvm() {
# This nvm_ensure_version_installed call can be a performance bottleneck
# on shell startup. Perhaps we can optimize it away or make it faster.
nvm_ensure_version_installed "$PROVIDED_VERSION"
nvm_ensure_version_installed "${VERSION}"
EXIT_CODE=$?
if [ "$EXIT_CODE" != "0" ]; then
return $EXIT_CODE
@ -2200,10 +2341,13 @@ nvm() {
shift
local NVM_SILENT
local NVM_LTS
while [ $# -gt 0 ]
do
case "$1" in
--silent) NVM_SILENT='--silent' ; shift ;;
--lts) NVM_LTS='*' ; shift ;;
--lts=*) NVM_LTS="${1##--lts=}" ; shift ;;
*)
if [ -n "$1" ]; then
break
@ -2214,7 +2358,7 @@ nvm() {
esac
done
if [ $# -lt 1 ]; then
if [ $# -lt 1 ] && [ -z "${NVM_LTS-}" ]; then
if [ -n "${NVM_SILENT-}" ]; then
nvm_rc_version >/dev/null 2>&1 && has_checked_nvmrc=1
else
@ -2222,19 +2366,18 @@ nvm() {
fi
if [ -n "$NVM_RC_VERSION" ]; then
VERSION="$(nvm_version "$NVM_RC_VERSION" || return 0)"
else
VERSION='N/A'
fi
if [ $VERSION = "N/A" ]; then
if [ "${VERSION:-N/A}" = 'N/A' ]; then
>&2 nvm --help
return 127
fi
fi
if [ -z "${NVM_LTS-}" ]; then
provided_version="$1"
if [ -n "$provided_version" ]; then
VERSION="$(nvm_version "$provided_version" || return 0)"
if [ "_$VERSION" = "_N/A" ] && ! nvm_is_valid_version "$provided_version"; then
if [ "_${VERSION:-N/A}" = '_N/A' ] && ! nvm_is_valid_version "$provided_version"; then
provided_version=''
if [ $has_checked_nvmrc -ne 1 ]; then
if [ -n "${NVM_SILENT-}" ]; then
@ -2248,6 +2391,7 @@ nvm() {
shift
fi
fi
fi
local NVM_IOJS
if nvm_is_iojs_version "$VERSION"; then
@ -2262,12 +2406,17 @@ nvm() {
ZSH_HAS_SHWORDSPLIT_UNSET="$(setopt | nvm_grep shwordsplit > /dev/null && nvm_echo $? || nvm_echo $?)"
setopt shwordsplit
fi
local LTS_ARG
if [ -n "${NVM_LTS-}" ]; then
LTS_ARG="--lts=${NVM_LTS-}"
VERSION=''
fi
if [ "_$VERSION" = "_N/A" ]; then
nvm_ensure_version_installed "$provided_version"
elif [ "$NVM_IOJS" = true ]; then
nvm exec "${NVM_SILENT-}" "$VERSION" iojs "$@"
nvm exec "${NVM_SILENT-}" "${LTS_ARG-}" "$VERSION" iojs "$@"
else
nvm exec "${NVM_SILENT-}" "$VERSION" node "$@"
nvm exec "${NVM_SILENT-}" "${LTS_ARG-}" "$VERSION" node "$@"
fi
EXIT_CODE="$?"
if [ "$ZSH_HAS_SHWORDSPLIT_UNSET" -eq 1 ] && nvm_has "unsetopt"; then
@ -2279,10 +2428,13 @@ nvm() {
shift
local NVM_SILENT
local NVM_LTS
while [ $# -gt 0 ]
do
case "$1" in
--silent) NVM_SILENT='--silent' ; shift ;;
--lts) NVM_LTS='*' ; shift ;;
--lts=*) NVM_LTS="${1##--lts=}" ; shift ;;
--) break ;;
--*)
nvm_err "Unsupported option \"$1\"."
@ -2300,9 +2452,12 @@ nvm() {
local provided_version
provided_version="$1"
if [ -n "$provided_version" ]; then
if [ "${NVM_LTS-}" != '' ]; then
provided_version="lts/${NVM_LTS:-*}"
VERSION="$provided_version"
elif [ -n "$provided_version" ]; then
VERSION="$(nvm_version "$provided_version" || return 0)"
if [ "_$VERSION" = "_N/A" ] && ! nvm_is_valid_version "$provided_version"; then
if [ "_$VERSION" = '_N/A' ] && ! nvm_is_valid_version "$provided_version"; then
if [ -n "${NVM_SILENT-}" ]; then
nvm_rc_version >/dev/null 2>&1
else
@ -2322,7 +2477,11 @@ nvm() {
fi
if [ -z "${NVM_SILENT-}" ]; then
if nvm_is_iojs_version "$VERSION"; then
if [ "${NVM_LTS-}" = '*' ]; then
nvm_echo "Running node latest LTS -> $(nvm_version "$VERSION")$(nvm use --silent "$VERSION" && nvm_print_npm_version)"
elif [ -n "${NVM_LTS-}" ]; then
nvm_echo "Running node LTS \"${NVM_LTS-}\" -> $(nvm_version "$VERSION")$(nvm use --silent "$VERSION" && nvm_print_npm_version)"
elif nvm_is_iojs_version "$VERSION"; then
nvm_echo "Running io.js $(nvm_strip_iojs_prefix "$VERSION")$(nvm use --silent "$VERSION" && nvm_print_npm_version)"
else
nvm_echo "Running node $VERSION$(nvm use --silent "$VERSION" && nvm_print_npm_version)"
@ -2342,19 +2501,43 @@ nvm() {
return $NVM_LS_EXIT_CODE
;;
"ls-remote" | "list-remote" )
local PATTERN
PATTERN="${2-}"
local LTS
local NVM_IOJS_PREFIX
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
local NVM_NODE_PREFIX
NVM_NODE_PREFIX="$(nvm_node_prefix)"
local PATTERN
local NVM_FLAVOR
while [ $# -gt 1 ]
do
case "$2" in
--lts)
LTS='*'
;;
--lts=*)
LTS="${2##--lts=}"
NVM_FLAVOR="${NVM_NODE_PREFIX}"
;;
--*)
nvm_err "Unsupported option \"$2\"."
return 55;
;;
*)
if [ -z "$PATTERN" ]; then
PATTERN="${2-}"
if [ -z "$NVM_FLAVOR" ]; then
case "_$PATTERN" in
"_$NVM_IOJS_PREFIX" | "_$NVM_NODE_PREFIX" )
"_$NVM_IOJS_PREFIX" | "_$NVM_NODE_PREFIX")
NVM_FLAVOR="$PATTERN"
PATTERN="$3"
PATTERN=""
;;
esac
fi
fi
;;
esac
shift
done
local NVM_LS_REMOTE_EXIT_CODE
NVM_LS_REMOTE_EXIT_CODE=0
@ -2364,7 +2547,7 @@ nvm() {
NVM_LS_REMOTE_POST_MERGED_OUTPUT=''
if [ "_$NVM_FLAVOR" != "_$NVM_IOJS_PREFIX" ]; then
local NVM_LS_REMOTE_OUTPUT
NVM_LS_REMOTE_OUTPUT=$(nvm_ls_remote "$PATTERN")
NVM_LS_REMOTE_OUTPUT=$(NVM_LTS="${LTS-}" nvm_ls_remote "$PATTERN")
# split output into two
NVM_LS_REMOTE_PRE_MERGED_OUTPUT="${NVM_LS_REMOTE_OUTPUT%%v4\.0\.0*}"
NVM_LS_REMOTE_POST_MERGED_OUTPUT="${NVM_LS_REMOTE_OUTPUT#$NVM_LS_REMOTE_PRE_MERGED_OUTPUT}"
@ -2375,7 +2558,7 @@ nvm() {
NVM_LS_REMOTE_IOJS_EXIT_CODE=0
local NVM_LS_REMOTE_IOJS_OUTPUT
NVM_LS_REMOTE_IOJS_OUTPUT=''
if [ "_$NVM_FLAVOR" != "_$NVM_NODE_PREFIX" ]; then
if [ "_$NVM_FLAVOR" != "_$NVM_NODE_PREFIX" ] && [ -z "${LTS-}" ]; then
NVM_LS_REMOTE_IOJS_OUTPUT=$(nvm_ls_remote_iojs "$PATTERN")
NVM_LS_REMOTE_IOJS_EXIT_CODE=$?
fi
@ -2445,7 +2628,7 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | nvm_grep -v "N/A" | command sed '/^$/d')"
"alias" )
local NVM_ALIAS_DIR
NVM_ALIAS_DIR="$(nvm_alias_path)"
command mkdir -p "$NVM_ALIAS_DIR"
command mkdir -p "$NVM_ALIAS_DIR/lts"
local NVM_CURRENT
NVM_CURRENT="$(nvm_ls_current)"
if [ $# -le 2 ]; then
@ -2460,6 +2643,14 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | nvm_grep -v "N/A" | command sed '/^$/d')"
NVM_CURRENT="${NVM_CURRENT}" nvm_print_default_alias "$ALIAS"
fi
done
local LTS_ALIAS
for ALIAS_PATH in "$NVM_ALIAS_DIR/lts/${2-}"*; do
LTS_ALIAS="$(NVM_LTS=true nvm_print_alias_path "$NVM_ALIAS_DIR" "$ALIAS_PATH")"
if [ -n "$LTS_ALIAS" ]; then
nvm_echo "${LTS_ALIAS-}"
fi
done
return
fi
if [ -z "${3-}" ]; then
@ -2549,7 +2740,28 @@ $NVM_LS_REMOTE_POST_MERGED_OUTPUT" | nvm_grep -v "N/A" | command sed '/^$/d')"
nvm_version "$2"
;;
"version-remote" )
nvm_remote_version "$2"
local NVM_LTS
local PATTERN
while [ $# -gt 1 ]
do
case "$2" in
--lts)
NVM_LTS='*'
;;
--lts=*)
NVM_LTS="${2##--lts=}"
;;
--*)
nvm_err "Unsupported option \"$2\"."
return 55;
;;
*)
PATTERN="${PATTERN:-$2}"
;;
esac
shift
done
NVM_VERSION_ONLY=true NVM_LTS="${NVM_LTS-}" nvm_remote_version "${PATTERN:-node}"
;;
"--version" )
nvm_echo '0.31.2'

View File

@ -0,0 +1,16 @@
#!/bin/sh
set -ex
. ../../../../nvm.sh
. ../../../common.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
die () { echo $@ ; exit 1; }
[ ! -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' exists and should not"
nvm alias >/dev/null 2>&1
[ -d "${LTS_ALIAS_PATH}" ] || die "'${LTS_ALIAS_PATH}' does not exist and should"

View File

@ -0,0 +1,10 @@
#!/bin/sh
. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
if [ -d "${LTS_ALIAS_PATH}" ]; then
mv "${LTS_ALIAS_PATH}" "${LTS_ALIAS_PATH}.bak"
rm -rf "${LTS_ALIAS_PATH}"
fi

View File

@ -0,0 +1,10 @@
#!/bin/sh
. ../../../../nvm.sh
LTS_ALIAS_PATH="$(nvm_alias_path)/lts"
if [ -d "${LTS_ALIAS_PATH}.bak" ]; then
rm -rf "${LTS_ALIAS_PATH}"
mv "${LTS_ALIAS_PATH}.bak" "${LTS_ALIAS_PATH}"
fi

View File

@ -0,0 +1,41 @@
iojs-v1.0.0
iojs-v1.0.1
iojs-v1.0.2
iojs-v1.0.3
iojs-v1.0.4
iojs-v1.1.0
iojs-v1.2.0
iojs-v1.3.0
iojs-v1.4.1
iojs-v1.4.2
iojs-v1.4.3
iojs-v1.5.0
iojs-v1.5.1
iojs-v1.6.0
iojs-v1.6.1
iojs-v1.6.2
iojs-v1.6.3
iojs-v1.6.4
iojs-v1.7.1
iojs-v1.8.1
iojs-v1.8.2
iojs-v1.8.3
iojs-v1.8.4
iojs-v2.0.0
iojs-v2.0.1
iojs-v2.0.2
iojs-v2.1.0
iojs-v2.2.0
iojs-v2.2.1
iojs-v2.3.0
iojs-v2.3.1
iojs-v2.3.2
iojs-v2.3.3
iojs-v2.3.4
iojs-v2.4.0
iojs-v2.5.0
iojs-v3.0.0
iojs-v3.1.0
iojs-v3.2.0
iojs-v3.3.0
iojs-v3.3.1

View File

@ -0,0 +1,18 @@
v4.2.0  (LTS: Argon)
v4.2.1  (LTS: Argon)
v4.2.2  (LTS: Argon)
v4.2.3  (LTS: Argon)
v4.2.4  (LTS: Argon)
v4.2.5  (LTS: Argon)
v4.2.6  (LTS: Argon)
v4.3.0  (LTS: Argon)
v4.3.1  (LTS: Argon)
v4.3.2  (LTS: Argon)
v4.4.0  (LTS: Argon)
v4.4.1  (LTS: Argon)
v4.4.2  (LTS: Argon)
v4.4.3  (LTS: Argon)
v4.4.4  (LTS: Argon)
v4.4.5  (LTS: Argon)
v4.4.6  (LTS: Argon)
v4.4.7  (Latest LTS: Argon)

View File

@ -0,0 +1,278 @@
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
v0.1.19
v0.1.20
v0.1.21
v0.1.22
v0.1.23
v0.1.24
v0.1.25
v0.1.26
v0.1.27
v0.1.28
v0.1.29
v0.1.30
v0.1.31
v0.1.32
v0.1.33
v0.1.90
v0.1.91
v0.1.92
v0.1.93
v0.1.94
v0.1.95
v0.1.96
v0.1.97
v0.1.98
v0.1.99
v0.1.100
v0.1.101
v0.1.102
v0.1.103
v0.1.104
v0.2.0
v0.2.1
v0.2.2
v0.2.3
v0.2.4
v0.2.5
v0.2.6
v0.3.0
v0.3.1
v0.3.2
v0.3.3
v0.3.4
v0.3.5
v0.3.6
v0.3.7
v0.3.8
v0.4.0
v0.4.1
v0.4.2
v0.4.3
v0.4.4
v0.4.5
v0.4.6
v0.4.7
v0.4.8
v0.4.9
v0.4.10
v0.4.11
v0.4.12
v0.5.0
v0.5.1
v0.5.2
v0.5.3
v0.5.4
v0.5.5
v0.5.6
v0.5.7
v0.5.8
v0.5.9
v0.5.10
v0.6.0
v0.6.1
v0.6.2
v0.6.3
v0.6.4
v0.6.5
v0.6.6
v0.6.7
v0.6.8
v0.6.9
v0.6.10
v0.6.11
v0.6.12
v0.6.13
v0.6.14
v0.6.15
v0.6.16
v0.6.17
v0.6.18
v0.6.19
v0.6.20
v0.6.21
v0.7.0
v0.7.1
v0.7.2
v0.7.3
v0.7.4
v0.7.5
v0.7.6
v0.7.7
v0.7.8
v0.7.9
v0.7.10
v0.7.11
v0.7.12
v0.8.0
v0.8.1
v0.8.2
v0.8.3
v0.8.4
v0.8.5
v0.8.6
v0.8.7
v0.8.8
v0.8.9
v0.8.10
v0.8.11
v0.8.12
v0.8.13
v0.8.14
v0.8.15
v0.8.16
v0.8.17
v0.8.18
v0.8.19
v0.8.20
v0.8.21
v0.8.22
v0.8.23
v0.8.24
v0.8.25
v0.8.26
v0.8.27
v0.8.28
v0.9.0
v0.9.1
v0.9.2
v0.9.3
v0.9.4
v0.9.5
v0.9.6
v0.9.7
v0.9.8
v0.9.9
v0.9.10
v0.9.11
v0.9.12
v0.10.0
v0.10.1
v0.10.2
v0.10.3
v0.10.4
v0.10.5
v0.10.6
v0.10.7
v0.10.8
v0.10.9
v0.10.10
v0.10.11
v0.10.12
v0.10.13
v0.10.14
v0.10.15
v0.10.16
v0.10.17
v0.10.18
v0.10.19
v0.10.20
v0.10.21
v0.10.22
v0.10.23
v0.10.24
v0.10.25
v0.10.26
v0.10.27
v0.10.28
v0.10.29
v0.10.30
v0.10.31
v0.10.32
v0.10.33
v0.10.34
v0.10.35
v0.10.36
v0.10.37
v0.10.38
v0.10.39
v0.10.40
v0.10.41
v0.10.42
v0.10.43
v0.10.44
v0.10.45
v0.10.46
v0.11.0
v0.11.1
v0.11.2
v0.11.3
v0.11.4
v0.11.5
v0.11.6
v0.11.7
v0.11.8
v0.11.9
v0.11.10
v0.11.11
v0.11.12
v0.11.13
v0.11.14
v0.11.15
v0.11.16
v0.12.0
v0.12.1
v0.12.2
v0.12.3
v0.12.4
v0.12.5
v0.12.6
v0.12.7
v0.12.8
v0.12.9
v0.12.10
v0.12.11
v0.12.12
v0.12.13
v0.12.14
v0.12.15
v4.0.0
v4.1.0
v4.1.1
v4.1.2
v4.2.0  (LTS: Argon)
v4.2.1  (LTS: Argon)
v4.2.2  (LTS: Argon)
v4.2.3  (LTS: Argon)
v4.2.4  (LTS: Argon)
v4.2.5  (LTS: Argon)
v4.2.6  (LTS: Argon)
v4.3.0  (LTS: Argon)
v4.3.1  (LTS: Argon)
v4.3.2  (LTS: Argon)
v4.4.0  (LTS: Argon)
v4.4.1  (LTS: Argon)
v4.4.2  (LTS: Argon)
v4.4.3  (LTS: Argon)
v4.4.4  (LTS: Argon)
v4.4.5  (LTS: Argon)
v4.4.6  (LTS: Argon)
v4.4.7  (Latest LTS: Argon)
v5.0.0
v5.1.0
v5.1.1
v5.2.0
v5.3.0
v5.4.0
v5.4.1
v5.5.0
v5.6.0
v5.7.0
v5.7.1
v5.8.0
v5.9.0
v5.9.1
v5.10.0
v5.10.1
v5.11.0
v5.11.1
v5.12.0
v6.0.0
v6.1.0
v6.2.0
v6.2.1
v6.2.2

View File

@ -0,0 +1,319 @@
v0.1.14
v0.1.15
v0.1.16
v0.1.17
v0.1.18
v0.1.19
v0.1.20
v0.1.21
v0.1.22
v0.1.23
v0.1.24
v0.1.25
v0.1.26
v0.1.27
v0.1.28
v0.1.29
v0.1.30
v0.1.31
v0.1.32
v0.1.33
v0.1.90
v0.1.91
v0.1.92
v0.1.93
v0.1.94
v0.1.95
v0.1.96
v0.1.97
v0.1.98
v0.1.99
v0.1.100
v0.1.101
v0.1.102
v0.1.103
v0.1.104
v0.2.0
v0.2.1
v0.2.2
v0.2.3
v0.2.4
v0.2.5
v0.2.6
v0.3.0
v0.3.1
v0.3.2
v0.3.3
v0.3.4
v0.3.5
v0.3.6
v0.3.7
v0.3.8
v0.4.0
v0.4.1
v0.4.2
v0.4.3
v0.4.4
v0.4.5
v0.4.6
v0.4.7
v0.4.8
v0.4.9
v0.4.10
v0.4.11
v0.4.12
v0.5.0
v0.5.1
v0.5.2
v0.5.3
v0.5.4
v0.5.5
v0.5.6
v0.5.7
v0.5.8
v0.5.9
v0.5.10
v0.6.0
v0.6.1
v0.6.2
v0.6.3
v0.6.4
v0.6.5
v0.6.6
v0.6.7
v0.6.8
v0.6.9
v0.6.10
v0.6.11
v0.6.12
v0.6.13
v0.6.14
v0.6.15
v0.6.16
v0.6.17
v0.6.18
v0.6.19
v0.6.20
v0.6.21
v0.7.0
v0.7.1
v0.7.2
v0.7.3
v0.7.4
v0.7.5
v0.7.6
v0.7.7
v0.7.8
v0.7.9
v0.7.10
v0.7.11
v0.7.12
v0.8.0
v0.8.1
v0.8.2
v0.8.3
v0.8.4
v0.8.5
v0.8.6
v0.8.7
v0.8.8
v0.8.9
v0.8.10
v0.8.11
v0.8.12
v0.8.13
v0.8.14
v0.8.15
v0.8.16
v0.8.17
v0.8.18
v0.8.19
v0.8.20
v0.8.21
v0.8.22
v0.8.23
v0.8.24
v0.8.25
v0.8.26
v0.8.27
v0.8.28
v0.9.0
v0.9.1
v0.9.2
v0.9.3
v0.9.4
v0.9.5
v0.9.6
v0.9.7
v0.9.8
v0.9.9
v0.9.10
v0.9.11
v0.9.12
v0.10.0
v0.10.1
v0.10.2
v0.10.3
v0.10.4
v0.10.5
v0.10.6
v0.10.7
v0.10.8
v0.10.9
v0.10.10
v0.10.11
v0.10.12
v0.10.13
v0.10.14
v0.10.15
v0.10.16
v0.10.17
v0.10.18
v0.10.19
v0.10.20
v0.10.21
v0.10.22
v0.10.23
v0.10.24
v0.10.25
v0.10.26
v0.10.27
v0.10.28
v0.10.29
v0.10.30
v0.10.31
v0.10.32
v0.10.33
v0.10.34
v0.10.35
v0.10.36
v0.10.37
v0.10.38
v0.10.39
v0.10.40
v0.10.41
v0.10.42
v0.10.43
v0.10.44
v0.10.45
v0.10.46
v0.11.0
v0.11.1
v0.11.2
v0.11.3
v0.11.4
v0.11.5
v0.11.6
v0.11.7
v0.11.8
v0.11.9
v0.11.10
v0.11.11
v0.11.12
v0.11.13
v0.11.14
v0.11.15
v0.11.16
v0.12.0
v0.12.1
v0.12.2
v0.12.3
v0.12.4
v0.12.5
v0.12.6
v0.12.7
v0.12.8
v0.12.9
v0.12.10
v0.12.11
v0.12.12
v0.12.13
v0.12.14
v0.12.15
iojs-v1.0.0
iojs-v1.0.1
iojs-v1.0.2
iojs-v1.0.3
iojs-v1.0.4
iojs-v1.1.0
iojs-v1.2.0
iojs-v1.3.0
iojs-v1.4.1
iojs-v1.4.2
iojs-v1.4.3
iojs-v1.5.0
iojs-v1.5.1
iojs-v1.6.0
iojs-v1.6.1
iojs-v1.6.2
iojs-v1.6.3
iojs-v1.6.4
iojs-v1.7.1
iojs-v1.8.1
iojs-v1.8.2
iojs-v1.8.3
iojs-v1.8.4
iojs-v2.0.0
iojs-v2.0.1
iojs-v2.0.2
iojs-v2.1.0
iojs-v2.2.0
iojs-v2.2.1
iojs-v2.3.0
iojs-v2.3.1
iojs-v2.3.2
iojs-v2.3.3
iojs-v2.3.4
iojs-v2.4.0
iojs-v2.5.0
iojs-v3.0.0
iojs-v3.1.0
iojs-v3.2.0
iojs-v3.3.0
iojs-v3.3.1
v4.0.0
v4.1.0
v4.1.1
v4.1.2
v4.2.0  (LTS: Argon)
v4.2.1  (LTS: Argon)
v4.2.2  (LTS: Argon)
v4.2.3  (LTS: Argon)
v4.2.4  (LTS: Argon)
v4.2.5  (LTS: Argon)
v4.2.6  (LTS: Argon)
v4.3.0  (LTS: Argon)
v4.3.1  (LTS: Argon)
v4.3.2  (LTS: Argon)
v4.4.0  (LTS: Argon)
v4.4.1  (LTS: Argon)
v4.4.2  (LTS: Argon)
v4.4.3  (LTS: Argon)
v4.4.4  (LTS: Argon)
v4.4.5  (LTS: Argon)
v4.4.6  (LTS: Argon)
v4.4.7  (Latest LTS: Argon)
v5.0.0
v5.1.0
v5.1.1
v5.2.0
v5.3.0
v5.4.0
v5.4.1
v5.5.0
v5.6.0
v5.7.0
v5.7.1
v5.8.0
v5.9.0
v5.9.1
v5.10.0
v5.10.1
v5.11.0
v5.11.1
v5.12.0
v6.0.0
v6.1.0
v6.2.0
v6.2.1
v6.2.2

View File

@ -0,0 +1,18 @@
v4.2.0 Argon
v4.2.1 Argon
v4.2.2 Argon
v4.2.3 Argon
v4.2.4 Argon
v4.2.5 Argon
v4.2.6 Argon
v4.3.0 Argon
v4.3.1 Argon
v4.3.2 Argon
v4.4.0 Argon
v4.4.1 Argon
v4.4.2 Argon
v4.4.3 Argon
v4.4.4 Argon
v4.4.5 Argon
v4.4.6 Argon
v4.4.7 Argon

View File

@ -0,0 +1,18 @@
v4.2.0 Argon
v4.2.1 Argon
v4.2.2 Argon
v4.2.3 Argon
v4.2.4 Argon
v4.2.5 Argon
v4.2.6 Argon
v4.3.0 Argon
v4.3.1 Argon
v4.3.2 Argon
v4.4.0 Argon
v4.4.1 Argon
v4.4.2 Argon
v4.4.3 Argon
v4.4.4 Argon
v4.4.5 Argon
v4.4.6 Argon
v4.4.7 Argon

View File

@ -234,24 +234,24 @@ v4.0.0
v4.1.0
v4.1.1
v4.1.2
v4.2.0
v4.2.1
v4.2.2
v4.2.3
v4.2.4
v4.2.5
v4.2.6
v4.3.0
v4.3.1
v4.3.2
v4.4.0
v4.4.1
v4.4.2
v4.4.3
v4.4.4
v4.4.5
v4.4.6
v4.4.7
v4.2.0 Argon
v4.2.1 Argon
v4.2.2 Argon
v4.2.3 Argon
v4.2.4 Argon
v4.2.5 Argon
v4.2.6 Argon
v4.3.0 Argon
v4.3.1 Argon
v4.3.2 Argon
v4.4.0 Argon
v4.4.1 Argon
v4.4.2 Argon
v4.4.3 Argon
v4.4.4 Argon
v4.4.5 Argon
v4.4.6 Argon
v4.4.7 Argon
v5.0.0
v5.1.0
v5.1.1

View File

@ -0,0 +1,2 @@
lts/argon|v4.4.7
lts/*|lts/argon

View File

@ -0,0 +1,32 @@
#!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_download nvm_ls_remote nvm_ls_remote_iojs
}
. ../../../nvm.sh
nvm deactivate 2>/dev/null || die 'unable to deactivate'
. ../../common.sh
REMOTE="$PWD/mocks/nvm_ls_remote.txt"
nvm_ls_remote() {
cat "$REMOTE"
}
REMOTE_IOJS="$PWD/mocks/nvm_ls_remote_iojs.txt"
nvm_ls_remote_iojs() {
cat "$REMOTE_IOJS"
}
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm ls-remote.txt"
OUTPUT="$(nvm ls-remote | sed 's/[ \t]*$//')"
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH" | sed 's/[ \t]*$//' )"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "bare nvm ls-remote did not output expected sorted versions; got $(echo ">$OUTPUT<") expected $(echo ">$EXPECTED_OUTPUT<")"
cleanup

View File

@ -0,0 +1,43 @@
#!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; }
cleanup() {
unset -f nvm_remote_version
}
. ../../../nvm.sh
. ../../common.sh
nvm_remote_version() {
echo "NVM_VERSION_ONLY:${NVM_VERSION_ONLY-},NVM_LTS:${NVM_LTS-},PATTERN:${PATTERN-}"
}
OUTPUT="$(nvm version-remote foo)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote foo\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
OUTPUT="$(nvm version-remote --lts foo)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:*,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote --lts foo\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
OUTPUT="$(nvm version-remote foo --lts)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:*,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote foo --lts\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
OUTPUT="$(nvm version-remote --lts=argon foo)"
EXPECTED_OUTPUT='NVM_VERSION_ONLY:true,NVM_LTS:argon,PATTERN:foo'
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote --lts=argon foo\` called nvm_remote_version with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
set +ex # needed for stderr
OUTPUT="$(nvm version-remote --foo bar 2>&1)"
set -ex
EXPECTED_OUTPUT='Unsupported option "--foo".'
EXIT_CODE="$(nvm version-remote --foo bar >/dev/null 2>&1 && echo $? || echo $?)"
[ "${EXIT_CODE}" = 55 ] || die "\`nvm version-remote --foo bar\` did not exit with code 55, got >${EXIT_CODE}<"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm version-remote --foo bar\` errored with >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
cleanup

View File

@ -8,13 +8,15 @@ cleanup() {
. ../../../nvm.sh
MOCKS_DIR="$PWD/mocks"
# sample output at the time the test was written
TAB_PATH="$PWD/mocks/nodejs.org-dist-index.tab"
TAB_PATH="$MOCKS_DIR/nodejs.org-dist-index.tab"
nvm_download() {
cat "$TAB_PATH"
}
EXPECTED_OUTPUT_PATH="$PWD/mocks/nvm_ls_remote.txt"
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote.txt"
OUTPUT="$(nvm_ls_remote foo)"
EXIT_CODE="$(nvm_ls_remote foo >/dev/null 2>&1 ; echo $?)"
@ -55,4 +57,15 @@ OUTPUT="$(nvm_ls_remote unstable)"
EXPECTED_OUTPUT="v0.11.16"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_ls_remote unstable did not output $EXPECTED_OUTPUT; got $OUTPUT"
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote LTS.txt"
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
OUTPUT="$(NVM_LTS='*' nvm_ls_remote)"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS='*' nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
EXPECTED_OUTPUT_PATH="$MOCKS_DIR/nvm_ls_remote LTS argon.txt"
EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
OUTPUT="$(NVM_LTS=argon nvm_ls_remote)"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS=argon nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
cleanup

View File

@ -0,0 +1,50 @@
#!/bin/sh
set -ex
die () { echo $@ ; cleanup ; exit 1; }
TEST_PATH="$PWD/test_output"
mkdir -p "$TEST_PATH"
CALL_COUNT_PATH="$TEST_PATH/call_count.txt"
: > "$CALL_COUNT_PATH"
ALIAS_ARGS_PATH="$TEST_PATH/nvm_make_alias_args.txt"
: > "$ALIAS_ARGS_PATH"
cleanup() {
unset -f nvm_download nvm_make_alias
rm -rf "$TEST_PATH"
}
. ../../../nvm.sh
set -ex
MOCKS_DIR="$PWD/mocks"
# sample output at the time the test was written
TAB_PATH="$MOCKS_DIR/nodejs.org-dist-index.tab"
nvm_download() {
cat "$TAB_PATH"
}
nvm_make_alias() {
CALL_COUNT="$(cat "$CALL_COUNT_PATH")"
CALL_COUNT="$((CALL_COUNT + 1))"
echo "$CALL_COUNT" > "$CALL_COUNT_PATH"
echo "${1}|${2}" >> "$ALIAS_ARGS_PATH"
}
nvm_ls_remote >/dev/null || die "nvm_ls_remote_failed?!"
CALL_COUNT="$(cat "$CALL_COUNT_PATH")"
EXPECTED_COUNT=2
[ "$CALL_COUNT" = "$EXPECTED_COUNT" ] || die "nvm_make_alias called $CALL_COUNT times; expected $EXPECTED_COUNT"
ARGS="$(cat "$ALIAS_ARGS_PATH")"
EXPECTED_ARGS_PATH="$MOCKS_DIR/nvm_make_alias LTS alias calls.txt"
EXPECTED_ARGS="$(cat "$EXPECTED_ARGS_PATH")"
[ "${ARGS}" = "${EXPECTED_ARGS}" ] || die "nvm_make_alias called with >${ARGS}<; expected >${EXPECTED_ARGS}<"
cleanup

View File

@ -26,34 +26,34 @@ EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
nvm_ls_remote() {
if ! nvm_is_iojs_version "$1"; then
echo "test output"
echo "more test output"
echo "pattern received: _$1_"
if [ -z "$1" ] || ! nvm_is_iojs_version "$1"; then
echo "test_output"
echo "more_test_output"
echo "pattern_received:_$1_"
fi
}
nvm_ls_remote_iojs() {
if [ -z "$1" ] || nvm_is_iojs_version "$1"; then
echo "test iojs output"
echo "more iojs test output"
echo "iojs pattern received: _$1_"
echo "test_iojs_output"
echo "more_iojs_test_output"
echo "iojs_pattern_received:_$1_"
fi
}
OUTPUT="$(nvm_remote_version foo)"
EXIT_CODE="$(nvm_remote_version foo >/dev/null 2>&1 ; echo $?)"
[ "_$OUTPUT" = "_pattern received: _foo_" ] \
[ "_$OUTPUT" = "_pattern_received:_foo_" ] \
|| die "nvm_remote_version foo did not return last line only of nvm_ls_remote foo; got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version foo did not exit with 0, got $EXIT_CODE"
OUTPUT="$(nvm_remote_version iojs-foo)"
EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
[ "_$OUTPUT" = "_iojs pattern received: _iojs-foo_" ] \
[ "_$OUTPUT" = "_iojs_pattern_received:_iojs-foo_" ] \
|| die "nvm_remote_version iojs-foo did not return last line only of nvm_ls_remote_iojs foo; got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs-foo did not exit with 0, got $EXIT_CODE"
OUTPUT="$(nvm_remote_version iojs)"
EXIT_CODE="$(nvm_remote_version iojs >/dev/null 2>&1 ; echo $?)"
[ "_$OUTPUT" = "_iojs pattern received: __" ] \
[ "_$OUTPUT" = "_iojs_pattern_received:__" ] \
|| die "nvm_remote_version iojs did not return last line only of nvm_ls_remote_iojs; got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs did not exit with 0, got $EXIT_CODE"

View File

@ -0,0 +1,31 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../nvm.sh
nvm unalias default >/dev/null 2>&1 || die 'unable to unalias default'
set +ex # needed for stderr
OUTPUT="$(nvm install --lts 3 2>&1)"
set -ex
EXIT_CODE="$(nvm install --lts 3 >/dev/null 2>&1 && echo $? || echo $?)"
EXPECTED_OUTPUT="Version '3' (with LTS filter) not found - try \`nvm ls-remote --lts\` to browse available versions."
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts 3\` did not exit with 3, got >${EXIT_CODE}<"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
set +ex # needed for stderr
OUTPUT="$(nvm install --lts=argon 3 2>&1)"
set -ex
EXIT_CODE="$(nvm install --lts=argon 3 >/dev/null 2>&1 && echo $? || echo $?)"
EXPECTED_OUTPUT="Version '3' (with LTS filter 'argon') not found - try \`nvm ls-remote --lts=argon\` to browse available versions."
[ "${EXIT_CODE}" = 3 ] || die "\`nvm install --lts=argon 3\` did not exit with 3, got >${EXIT_CODE}<"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm install --lts=argon 3\` output >${OUTPUT}<, expected >${EXPECTED_OUTPUT}<"
set +e # TODO: fix
nvm install --lts 4.2.2 || die 'nvm install --lts 4.2.2 failed'
set -e
[ "$(nvm current)" = "v4.2.2" ] || die "v4.2.2 not current, got $(nvm_current)"

View File

@ -3,6 +3,7 @@
. ../../nvm.sh
nvm deactivate
nvm uninstall v0.10.7
nvm uninstall v4.2.2
if [ -f ".nvmrc" ]; then
rm .nvmrc

View File

@ -0,0 +1,18 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm install --lts || die 'nvm install --lts failed'
NPM_VERSION_LTS="$(npm --version)"
TEST_STRING="foo bar"
nvm use 1.0.0 && [ "$(node --version)" = "v1.0.0" ] || die "\`nvm use\` failed!"
[ "$(nvm exec --lts npm --version | tail -1)" = "$NPM_VERSION_LTS" ] || die "`nvm exec` failed to run with the correct version"
[ "$(nvm exec --lts bash -c "printf '$TEST_STRING'" | tail -1)" = "$TEST_STRING" ] || die "\`nvm exec\` failed to run with a command including whitespace"

View File

@ -3,6 +3,7 @@
. ../../../nvm.sh
nvm install 0.10.7
nvm install 1.0.0
nvm install --lts
if [ -f ".nvmrc" ]; then
mv .nvmrc .nvmrc.bak

View File

@ -4,6 +4,7 @@
nvm deactivate
nvm uninstall v0.10.7
nvm uninstall v1.0.0
nvm uninstall --lts
rm .nvmrc

View File

@ -0,0 +1,15 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
OUTPUT="$(nvm run --silent --lts --version)"
EXPECTED_OUTPUT="$(nvm_match_version 'lts/*')"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm run --lts\` failed to run with the correct version; expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"
OUTPUT="$(nvm run --silent --lts=argon --version)"
EXPECTED_OUTPUT="$(nvm_match_version 'lts/argon')"
[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] || die "\`nvm run --lts=argon\` failed to run with the correct version; expected >${EXPECTED_OUTPUT}<, got >${OUTPUT}<"

View File

@ -1,7 +1,10 @@
#!/bin/sh
. ../../../nvm.sh
nvm install 0.10.7
nvm install --lts=argon
nvm install --lts
if [ -f ".nvmrc" ]; then
mv .nvmrc .nvmrc.bak

View File

@ -1,8 +1,11 @@
#!/bin/sh
. ../../../nvm.sh
nvm deactivate
nvm uninstall v0.10.7
nvm uninstall --lts=argon
nvm uninstall --lts
rm .nvmrc

View File

@ -0,0 +1,22 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm deactivate >/dev/null 2>&1 || die 'deactivate failed'
nvm use --lts || die 'nvm use --lts failed'
OUTPUT="$(nvm current)"
EXPECTED_OUTPUT="$(nvm_resolve_alias 'lts/*')"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --lts' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
OUTPUT="$(nvm use --silent --lts)"
EXPECTED_OUTPUT=""
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --silent --lts' output was not silenced '$EXPECTED_OUTPUT'; got '$OUTPUT'"

View File

@ -0,0 +1,22 @@
#!/bin/sh
set -ex
die () { echo $@ ; exit 1; }
. ../../../nvm.sh
nvm deactivate 2>&1 >/dev/null || die 'deactivate failed'
nvm use --lts=testing || die 'nvm use --lts=testing failed'
OUTPUT="$(nvm current)"
EXPECTED_OUTPUT="$(nvm_resolve_alias 'lts/testing')"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --lts=testing' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
OUTPUT="$(nvm use --silent --lts=testing)"
EXPECTED_OUTPUT=""
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|| die "'nvm use --silent --lts=testing' output was not silenced '$EXPECTED_OUTPUT'; got '$OUTPUT'"

View File

@ -6,6 +6,10 @@ mkdir -p "${NVM_DIR}/.nvm_use_bak"
if [ -d "${NVM_DIR}/v*" ]; then
mv "${NVM_DIR}/v*" "${NVM_DIR}/.nvm_use_bak/"
fi
mkdir -p "${NVM_DIR}/.nvm_use_lts_alias_bak"
if [ -d "${NVM_DIR}/alias/lts" ]; then
mv "${NVM_DIR}/alias/lts/*" "${NVM_DIR}/.nvm_use_lts_alias_bak/"
fi
for VERSION in "0.8.7" "0.9.1" "0.10.1" "0.11.1"; do
nvm install "v$VERSION"
@ -14,3 +18,6 @@ done
for VERSION in "1.0.0" "1.0.1"; do
nvm install "iojs-v$VERSION"
done
nvm_make_alias lts/testing 0.10.1
nvm_make_alias 'lts/*' lts/testing

View File

@ -10,7 +10,13 @@ for VERSION in "1.0.0" "1.0.1"; do
nvm uninstall "iojs-v$VERSION"
done
if [ -d ../../../.nvm_use_bak/* ]; then
mv ../../../.nvm_use_bak/* ../../../
if [ -d "${NVM_DIR}/.nvm_use_bak/*" ]; then
mv "${NVM_DIR}/.nvm_use_bak/*" "${NVM_DIR}"
rmdir "${NVM_DIR}/.nvm_use_bak"
fi
if [ -d "${NVM_DIR}/.nvm_use_lts_alias_bak" ]; then
rm -rf "${NVM_DIR}/alias/lts/*"
mv "${NVM_DIR}/.nvm_use_lts_alias_bak/*" "${NVM_DIR}/alias/lts/"
rmdir "${NVM_DIR}/.nvm_use_lts_alias_bak"
fi
rmdir ../../../.nvm_use_bak

View File

@ -10,10 +10,33 @@ echo "creating $MOCKS_DIR"
mkdir -p "$MOCKS_DIR"
. "$NVM_DIR/nvm.sh" --no-use
nvm deactivate 2> /dev/null
nvm_is_version_installed() {
return 1
}
nvm_make_alias() {
# prevent local alias creation
return 0
}
nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote.txt"
nvm_ls_remote_iojs > "$MOCKS_DIR/nvm_ls_remote_iojs.txt"
NVM_LTS=* nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS.txt"
NVM_LTS=argon nvm_ls_remote > "$MOCKS_DIR/nvm_ls_remote LTS argon.txt"
nvm_download -L -s "$NVM_NODEJS_ORG_MIRROR/index.tab" -o - > "$MOCKS_DIR/nodejs.org-dist-index.tab"
nvm_download -L -s "$NVM_IOJS_ORG_MIRROR/index.tab" -o - > "$MOCKS_DIR/iojs.org-dist-index.tab"
nvm ls-remote > "$MOCKS_DIR/nvm ls-remote.txt"
nvm ls-remote --lts > "$MOCKS_DIR/nvm ls-remote lts.txt"
nvm ls-remote node > "$MOCKS_DIR/nvm ls-remote node.txt"
nvm ls-remote iojs > "$MOCKS_DIR/nvm ls-remote iojs.txt"
ALIAS_PATH="$MOCKS_DIR/nvm_make_alias LTS alias calls.txt"
: > "$ALIAS_PATH"
nvm_make_alias() {
# prevent local alias creation, and store arguments
echo "${1}|${2}" >> "$ALIAS_PATH"
}
nvm ls-remote --lts
echo "done! Don't forget to git commit them."