Compare commits

...

4 Commits

Author SHA1 Message Date
Jordan Harband
86cccd02da
[Fix] install-latest-npm: npm v11 is out 2024-12-16 10:03:18 -08:00
Jordan Harband
9ff8f5014c
[Tests] ensure node can be found by npm 2024-11-23 10:12:26 -10:00
Jordan Harband
572cdf475d
[Tests] use a newer node version for this test to avoid flakiness 2024-11-22 13:15:01 -10:00
Jordan Harband
b72e5c0d0f
[actions] TOC: use latest LTS node 2024-11-22 21:44:36 -10:00
4 changed files with 30 additions and 3 deletions

View File

@ -37,6 +37,11 @@ jobs:
matrix: matrix:
node-version: ${{ fromJson(needs.matrix.outputs.latest) }} node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
include: include:
- node-version: "21"
- node-version: "20.5"
- node-version: "20.4"
- node-version: "14.17"
- node-version: "14.16"
- node-version: "9.2" - node-version: "9.2"
- node-version: "9.1" - node-version: "9.1"
- node-version: "9.0" - node-version: "9.0"

View File

@ -20,6 +20,7 @@ jobs:
allowed-endpoints: allowed-endpoints:
github.com:443 github.com:443
registry.npmjs.org:443 registry.npmjs.org:443
api.github.com:443
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
# https://github.com/actions/checkout/issues/217#issue-599945005 # https://github.com/actions/checkout/issues/217#issue-599945005
@ -30,7 +31,7 @@ jobs:
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: '16' node-version: 'lts/*'
- run: npm install - run: npm install
- run: npm run doctoc - run: npm run doctoc
- name: commit changes - name: commit changes

21
nvm.sh
View File

@ -354,6 +354,21 @@ nvm_install_latest_npm() {
if [ $NVM_IS_19_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 20.5.0; then if [ $NVM_IS_19_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 20.5.0; then
NVM_IS_20_5_OR_ABOVE=1 NVM_IS_20_5_OR_ABOVE=1
fi fi
local NVM_IS_20_17_or_ABOVE
NVM_IS_20_17_or_ABOVE=0
if [ $NVM_IS_20_5_OR_ABOVE -eq 1 ] && nvm_version_greater 20.17.0 "${NODE_VERSION}"; then
NVM_IS_20_17_or_ABOVE=1
fi
local NVM_IS_21_OR_ABOVE
NVM_IS_21_OR_ABOVE=0
if [ $NVM_IS_20_17_or_ABOVE -eq 1 ] && nvm_version_greater 21.0.0 "${NODE_VERSION}"; then
NVM_IS_21_OR_ABOVE=1
fi
local NVM_IS_22_9_OR_ABOVE
NVM_IS_22_9_OR_ABOVE=0
if [ $NVM_IS_21_OR_ABOVE -eq 1 ] && nvm_version_greater 22.9.0 "${NODE_VERSION}"; then
NVM_IS_22_9_OR_ABOVE=1
fi
if [ $NVM_IS_4_4_OR_BELOW -eq 1 ] || { if [ $NVM_IS_4_4_OR_BELOW -eq 1 ] || {
[ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater 5.10.0 "${NODE_VERSION}"; \ [ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater 5.10.0 "${NODE_VERSION}"; \
@ -401,6 +416,12 @@ nvm_install_latest_npm() {
; then ; then
nvm_echo '* `npm` `v9.x` is the last version that works on `node` `< v18.17`, `v19`, or `v20.0` - `v20.4`' nvm_echo '* `npm` `v9.x` is the last version that works on `node` `< v18.17`, `v19`, or `v20.0` - `v20.4`'
$NVM_NPM_CMD install -g npm@9 $NVM_NPM_CMD install -g npm@9
elif \
[ $NVM_IS_20_17_or_ABOVE -eq 0 ] \
|| { [ $NVM_IS_21_OR_ABOVE -eq 1 ] && [ $NVM_IS_22_9_OR_ABOVE -eq 0 ]; } \
; then
nvm_echo '* `npm` `v10.x` is the last version that works on `node` `< v20.17`, `v21`, or `v22.0` - `v22.8`'
$NVM_NPM_CMD install -g npm@10
else else
nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!' nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!'
$NVM_NPM_CMD install -g npm $NVM_NPM_CMD install -g npm

View File

@ -6,7 +6,7 @@ die () { echo "$@" ; exit 1; }
\. ../../../nvm.sh \. ../../../nvm.sh
# Version to install/uninstall # Version to install/uninstall
NVM_TEST_VERSION=5.10.1 NVM_TEST_VERSION=15.5.0
# Make sure it's not already here # Make sure it's not already here
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION [ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
@ -19,7 +19,7 @@ nvm ls | grep "$NVM_TEST_VERSION" || die "Failed to install node"
# Install global module as root # Install global module as root
npm_path=$(which npm) npm_path=$(which npm)
sudo -n "$npm_path" install jspm@'<2' -g || die 'either sudo failed, or `npm install jspm -g` failed`' PATH="${PATH}" sudo -n "$npm_path" install jspm@'<2' -g || die 'either sudo failed, or `npm install jspm -g` failed`'
# Switch to another version so we can uninstall # Switch to another version so we can uninstall
nvm use 0.12.7 nvm use 0.12.7