mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-12-20 20:24:22 +08:00
Compare commits
5 Commits
temp6
...
bdf0c19db4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdf0c19db4 | ||
|
|
759f70f196 | ||
|
|
06a9179309 | ||
|
|
74eb396099 | ||
|
|
477353e1a4 |
60
nvm.sh
60
nvm.sh
@@ -136,15 +136,17 @@ nvm_download() {
|
|||||||
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}"
|
eval "curl -q --fail ${CURL_COMPRESSED_FLAG:-} ${CURL_HEADER_FLAG:-} ${NVM_DOWNLOAD_ARGS}"
|
||||||
elif nvm_has "wget"; then
|
elif nvm_has "wget"; then
|
||||||
# Emulate curl with wget
|
# Emulate curl with wget
|
||||||
ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
|
ARGS=$(nvm_echo "$@" | command sed "
|
||||||
-e 's/--compressed //' \
|
s/--progress-bar /--progress=bar /
|
||||||
-e 's/--fail //' \
|
s/--compressed //
|
||||||
-e 's/-L //' \
|
s/--fail //
|
||||||
-e 's/-I /--server-response /' \
|
s/-L //
|
||||||
-e 's/-s /-q /' \
|
s/-I /--server-response /
|
||||||
-e 's/-sS /-nv /' \
|
s/-s /-q /
|
||||||
-e 's/-o /-O /' \
|
s/-sS /-nv /
|
||||||
-e 's/-C - /-c /')
|
s/-o /-O /
|
||||||
|
s/-C - /-c /
|
||||||
|
")
|
||||||
|
|
||||||
if [ -n "${NVM_AUTH_HEADER:-}" ]; then
|
if [ -n "${NVM_AUTH_HEADER:-}" ]; then
|
||||||
ARGS="${ARGS} --header \"${NVM_AUTH_HEADER}\""
|
ARGS="${ARGS} --header \"${NVM_AUTH_HEADER}\""
|
||||||
@@ -1413,11 +1415,11 @@ nvm_add_iojs_prefix() {
|
|||||||
nvm_strip_iojs_prefix() {
|
nvm_strip_iojs_prefix() {
|
||||||
local NVM_IOJS_PREFIX
|
local NVM_IOJS_PREFIX
|
||||||
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
|
NVM_IOJS_PREFIX="$(nvm_iojs_prefix)"
|
||||||
if [ "${1-}" = "${NVM_IOJS_PREFIX}" ]; then
|
|
||||||
nvm_echo
|
case "${1-}" in
|
||||||
else
|
"${NVM_IOJS_PREFIX}") nvm_echo ;;
|
||||||
nvm_echo "${1#"${NVM_IOJS_PREFIX}"-}"
|
*) nvm_echo "${1#"${NVM_IOJS_PREFIX}"-}" ;;
|
||||||
fi
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
nvm_ls() {
|
nvm_ls() {
|
||||||
@@ -1549,12 +1551,15 @@ nvm_ls() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${NVM_ADD_SYSTEM-}" = true ]; then
|
if [ "${NVM_ADD_SYSTEM-}" = true ]; then
|
||||||
if [ -z "${PATTERN}" ] || [ "${PATTERN}" = 'v' ]; then
|
case "${PATTERN}" in
|
||||||
|
'' | v)
|
||||||
VERSIONS="${VERSIONS}
|
VERSIONS="${VERSIONS}
|
||||||
system"
|
system"
|
||||||
elif [ "${PATTERN}" = 'system' ]; then
|
;;
|
||||||
|
system)
|
||||||
VERSIONS="system"
|
VERSIONS="system"
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${VERSIONS}" ]; then
|
if [ -z "${VERSIONS}" ]; then
|
||||||
@@ -1688,15 +1693,10 @@ EOF
|
|||||||
LTS="${LTS#lts/}"
|
LTS="${LTS#lts/}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
VERSIONS="$({ command awk -v lts="${LTS-}" -v pattern="${PATTERN:-.*}" '
|
VERSIONS="$( { command awk -v lts="${LTS-}" '{
|
||||||
BEGIN {
|
if (!$1) { next }
|
||||||
if (pattern == "") pattern = ".*"
|
if (lts && $10 ~ /^\-?$/) { next }
|
||||||
}
|
if (lts && lts != "*" && tolower($10) !~ tolower(lts)) { next }
|
||||||
{
|
|
||||||
if (!$1) { next } # skip empty lines
|
|
||||||
if (lts && $10 ~ /^\-?$/) { next } # skip if LTS wanted, and row is not LTS
|
|
||||||
if (lts && lts != "*" && tolower($10) !~ tolower(lts)) { next } # skip if LTS filter does not match
|
|
||||||
if ($1 !~ pattern) { next } # only keep rows matching the pattern
|
|
||||||
if ($10 !~ /^\-?$/) {
|
if ($10 !~ /^\-?$/) {
|
||||||
if ($10 && $10 != prev) {
|
if ($10 && $10 != prev) {
|
||||||
print $1, $10, "*"
|
print $1, $10, "*"
|
||||||
@@ -1708,6 +1708,7 @@ EOF
|
|||||||
}
|
}
|
||||||
prev=$10;
|
prev=$10;
|
||||||
}' \
|
}' \
|
||||||
|
| nvm_grep -w "${PATTERN:-.*}" \
|
||||||
| $SORT_COMMAND; } << EOF
|
| $SORT_COMMAND; } << EOF
|
||||||
$VERSION_LIST
|
$VERSION_LIST
|
||||||
EOF
|
EOF
|
||||||
@@ -2072,6 +2073,11 @@ nvm_get_arch() {
|
|||||||
local EXIT_CODE
|
local EXIT_CODE
|
||||||
local LONG_BIT
|
local LONG_BIT
|
||||||
|
|
||||||
|
if [ -n "$NVM_NODEJS_ORG_ARCH" ]; then
|
||||||
|
nvm_echo "${NVM_NODEJS_ORG_ARCH}"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
NVM_OS="$(nvm_get_os)"
|
NVM_OS="$(nvm_get_os)"
|
||||||
# If the OS is SunOS, first try to use pkgsrc to guess
|
# If the OS is SunOS, first try to use pkgsrc to guess
|
||||||
# the most appropriate arch. If it's not available, use
|
# the most appropriate arch. If it's not available, use
|
||||||
@@ -2736,7 +2742,7 @@ nvm_npm_global_modules() {
|
|||||||
local NPMLIST
|
local NPMLIST
|
||||||
local VERSION
|
local VERSION
|
||||||
VERSION="$1"
|
VERSION="$1"
|
||||||
NPMLIST=$(nvm use "${VERSION}" >/dev/null && npm list -g --depth=0 2>/dev/null | command sed 1,1d | nvm_grep -v 'UNMET PEER DEPENDENCY')
|
NPMLIST=$(nvm use "${VERSION}" >/dev/null && npm list -g --depth=0 2>/dev/null | command sed -e '1d' -e '/UNMET PEER DEPENDENCY/d')
|
||||||
|
|
||||||
local INSTALLS
|
local INSTALLS
|
||||||
INSTALLS=$(nvm_echo "${NPMLIST}" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' | command xargs)
|
INSTALLS=$(nvm_echo "${NPMLIST}" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' | command xargs)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
"dockerfile_lint": "^0.3.4",
|
"dockerfile_lint": "^0.3.4",
|
||||||
"doctoc": "^2.2.1",
|
"doctoc": "^2.2.1",
|
||||||
"eclint": "^2.8.1",
|
"eclint": "^2.8.1",
|
||||||
"markdown-link-check": "^3.12.2",
|
"markdown-link-check": "^3.13.6",
|
||||||
"replace": "^1.2.2",
|
"replace": "^1.2.2",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"urchin": "^0.0.5"
|
"urchin": "^0.0.5"
|
||||||
|
|||||||
@@ -83,11 +83,4 @@ EXPECTED_OUTPUT="$(cat "$EXPECTED_OUTPUT_PATH")"
|
|||||||
OUTPUT="$(NVM_LTS=argon nvm_ls_remote)"
|
OUTPUT="$(NVM_LTS=argon nvm_ls_remote)"
|
||||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS=argon nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "\`NVM_LTS=argon nvm_ls_remote\` did not output >$EXPECTED_OUTPUT<; got >$OUTPUT<"
|
||||||
|
|
||||||
OUTPUT="$(nvm_ls_remote Argon 2>&1)"
|
|
||||||
EXIT_CODE=$?
|
|
||||||
[ $EXIT_CODE -eq 3 ] || die "nvm_ls_remote Argon did not exit 3, got '${EXIT_CODE}'"
|
|
||||||
|
|
||||||
EXPECTED_OUTPUT='N/A'
|
|
||||||
[ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] || die "nvm_ls_remote Argon did not output expected error message; got >${OUTPUT}< expected >${EXPECTED_OUTPUT}<"
|
|
||||||
|
|
||||||
cleanup
|
cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user