Merge branch 'master' into master

This commit is contained in:
Brooke 2021-12-02 15:52:46 +08:00 committed by GitHub
commit 329fbb4078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 16 deletions

View File

@ -87,6 +87,9 @@ jobs:
wsl_matrix: wsl_matrix:
name: 'WSL nvm install' name: 'WSL nvm install'
defaults:
run:
shell: wsl-bash {0}
runs-on: windows-latest runs-on: windows-latest
env: env:
WSLENV: NVM_INSTALL_GITHUB_REPO:NVM_INSTALL_VERSION:/p WSLENV: NVM_INSTALL_GITHUB_REPO:NVM_INSTALL_VERSION:/p
@ -99,19 +102,24 @@ jobs:
- Ubuntu-18.04 - Ubuntu-18.04
npm-node-version: npm-node-version:
- '--lts' - '--lts'
- '14'
- '12'
- '11' - '11'
- '10'
method:
- ''
- 'script'
steps: steps:
- uses: Vampire/setup-wsl@v1 - uses: Vampire/setup-wsl@v1
with: with:
distribution: ${{ matrix.wsl-distrib }} distribution: ${{ matrix.wsl-distrib }}
additional-packages: bash git curl ca-certificates additional-packages: bash git curl ca-certificates wget
- name: Retrieve nvm on WSL - name: Retrieve nvm on WSL
shell: wsl-bash {0}
run: | run: |
if [ "${{ matrix.wsl-distrib }}" = "Ubuntu-18.04" ] && [ "${{ matrix.npm-node-version }}" = "--lts" ]; then if [ -z "${{ matrix.method }}" ]; then
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | bash curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | bash
else else
curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | METHOD=script bash curl -fsSLo- "https://raw.githubusercontent.com/${NVM_INSTALL_GITHUB_REPO}/${NVM_INSTALL_VERSION}/install.sh" | METHOD="${{matrix.method}}" bash
fi fi
. "$HOME/.nvm/nvm.sh" . "$HOME/.nvm/nvm.sh"
nvm install ${{ matrix.npm-node-version }} nvm install ${{ matrix.npm-node-version }}

View File

@ -572,7 +572,7 @@ cdnvm() {
nvm use default; nvm use default;
fi fi
elif [[ -s $nvm_path/.nvmrc && -r $nvm_path/.nvmrc ]]; then elif [[ -s $nvm_path/.nvmrc && -r $nvm_path/.nvmrc ]]; then
declare nvm_version declare nvm_version
nvm_version=$(<"$nvm_path"/.nvmrc) nvm_version=$(<"$nvm_path"/.nvmrc)
@ -913,6 +913,7 @@ Some issues you may encounter:
$ NODE_OPTIONS="--max-old-space-size=4096" ./node_modules/.bin/your_node_package $ NODE_OPTIONS="--max-old-space-size=4096" ./node_modules/.bin/your_node_package
``` ```
- when using `nvm` to install some versions, the compilation fails - when using `nvm` to install some versions, the compilation fails
- after `nvm` successfully compiles some versions, `yarn` or `npm` may later fail to install packages with an `incorrect data check` error.
One solution to this issue is to change the architecture of your shell from arm64 to x86. One solution to this issue is to change the architecture of your shell from arm64 to x86.

View File

@ -160,11 +160,11 @@ install_nvm_from_git() {
exit 2 exit 2
} }
if [ -n "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then if [ -n "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then if command git --no-pager --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1 command git --no-pager --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1
else else
nvm_echo >&2 "Your version of git is out of date. Please update it!" nvm_echo >&2 "Your version of git is out of date. Please update it!"
command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch -D master >/dev/null 2>&1 command git --no-pager --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch -D master >/dev/null 2>&1
fi fi
fi fi
@ -300,7 +300,7 @@ nvm_detect_profile() {
nvm_check_global_modules() { nvm_check_global_modules() {
local NPM_COMMAND local NPM_COMMAND
NPM_COMMAND="$(command -v npm 2>/dev/null)" || return 0 NPM_COMMAND="$(command -v npm 2>/dev/null)" || return 0
[ -n "${NVM_DIR}" ] && [ -z "${NPM_COMMAND%%$NVM_DIR/*}" ] && return 0 [ -n "${NVM_DIR}" ] && [ -z "${NPM_COMMAND%%"$NVM_DIR"/*}" ] && return 0
local NPM_VERSION local NPM_VERSION
NPM_VERSION="$(npm --version)" NPM_VERSION="$(npm --version)"
@ -360,7 +360,7 @@ nvm_do_install() {
# Autodetect install method # Autodetect install method
if nvm_has git; then if nvm_has git; then
install_nvm_from_git install_nvm_from_git
elif nvm_has nvm_download; then elif nvm_has curl || nvm_has wget; then
install_nvm_as_script install_nvm_as_script
else else
nvm_echo >&2 'You need git, curl, or wget to install nvm' nvm_echo >&2 'You need git, curl, or wget to install nvm'
@ -373,7 +373,7 @@ nvm_do_install() {
fi fi
install_nvm_from_git install_nvm_from_git
elif [ "${METHOD}" = 'script' ]; then elif [ "${METHOD}" = 'script' ]; then
if ! nvm_has nvm_download; then if ! nvm_has curl && ! nvm_has wget; then
nvm_echo >&2 "You need curl or wget to install nvm" nvm_echo >&2 "You need curl or wget to install nvm"
exit 1 exit 1
fi fi

8
nvm.sh
View File

@ -634,7 +634,7 @@ nvm_remote_versions() {
NVM_LS_REMOTE_EXIT_CODE=$? NVM_LS_REMOTE_EXIT_CODE=$?
# split output into two # split output into two
NVM_LS_REMOTE_PRE_MERGED_OUTPUT="${NVM_LS_REMOTE_OUTPUT%%v4\.0\.0*}" 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}" NVM_LS_REMOTE_POST_MERGED_OUTPUT="${NVM_LS_REMOTE_OUTPUT#"$NVM_LS_REMOTE_PRE_MERGED_OUTPUT"}"
fi fi
local NVM_LS_REMOTE_IOJS_EXIT_CODE local NVM_LS_REMOTE_IOJS_EXIT_CODE
@ -940,7 +940,7 @@ nvm_print_alias_path() {
return 2 return 2
fi fi
local ALIAS local ALIAS
ALIAS="${ALIAS_PATH##${NVM_ALIAS_DIR}\/}" ALIAS="${ALIAS_PATH##"${NVM_ALIAS_DIR}"\/}"
local DEST local DEST
DEST="$(nvm_alias "${ALIAS}" 2>/dev/null)" ||: DEST="$(nvm_alias "${ALIAS}" 2>/dev/null)" ||:
if [ -n "${DEST}" ]; then if [ -n "${DEST}" ]; then
@ -1186,7 +1186,7 @@ nvm_strip_iojs_prefix() {
if [ "${1-}" = "${NVM_IOJS_PREFIX}" ]; then if [ "${1-}" = "${NVM_IOJS_PREFIX}" ]; then
nvm_echo nvm_echo
else else
nvm_echo "${1#${NVM_IOJS_PREFIX}-}" nvm_echo "${1#"${NVM_IOJS_PREFIX}"-}"
fi fi
} }
@ -2614,7 +2614,7 @@ nvm_node_version_has_solaris_binary() {
# Succeeds if $VERSION represents a version (node, io.js or merged) that has a # Succeeds if $VERSION represents a version (node, io.js or merged) that has a
# Solaris binary, fails otherwise. # Solaris binary, fails otherwise.
nvm_has_solaris_binary() { nvm_has_solaris_binary() {
local VERSION=$1 local VERSION="${1-}"
if nvm_is_merged_node_version "${VERSION}"; then if nvm_is_merged_node_version "${VERSION}"; then
return 0 # All merged node versions have a Solaris binary return 0 # All merged node versions have a Solaris binary
elif nvm_is_iojs_version "${VERSION}"; then elif nvm_is_iojs_version "${VERSION}"; then

View File

@ -41,7 +41,7 @@
"homepage": "https://github.com/nvm-sh/nvm", "homepage": "https://github.com/nvm-sh/nvm",
"devDependencies": { "devDependencies": {
"dockerfile_lint": "^0.3.4", "dockerfile_lint": "^0.3.4",
"doctoc": "^2.0.1", "doctoc": "^2.1.0",
"eclint": "^2.8.1", "eclint": "^2.8.1",
"markdown-link-check": "^3.8.7", "markdown-link-check": "^3.8.7",
"replace": "^1.2.1", "replace": "^1.2.1",