Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,31 @@ python3 --version
pyenv versions | sed 's/^/ /'

echo "- Node.js:"
export NVM_DIR="${NVM_DIR:-"$HOME/.nvm"}"
if [ -s "$NVM_DIR/nvm.sh" ]; then
# shellcheck disable=SC1091
. "$NVM_DIR/nvm.sh"
fi
export NVM_NO_COLORS=1
original_nvm_default=""
nvm_alias_default_output="$(nvm alias --no-colors default 2>/dev/null || true)"
if [ -n "${nvm_alias_default_output}" ]; then
parsed_nvm_default="$(printf '%s\n' "${nvm_alias_default_output}" | head -n 1 | awk '{print $3}')"
Comment on lines +19 to +21

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Capture default nvm alias without mutating aliases

The new Node block executes nvm alias --no-colors default, but --no-colors in this position is treated as the alias name, so this call actually creates/updates an alias called --no-colors and returns default as its value. original_nvm_default therefore becomes the literal string default, and the later restore step calls nvm alias default default, leaving the default alias pointing to itself and breaking nvm use default for the user until they manually reset it. The script can also terminate early if that restore command fails under set -e. This regression occurs whenever the script runs in an environment with nvm.

Useful? React with 👍 / 👎.

if [ -n "${parsed_nvm_default}" ] && [ "${parsed_nvm_default}" != "none" ] && [ "${parsed_nvm_default}" != "N/A" ]; then
original_nvm_default="${parsed_nvm_default}"
fi
fi
for version in "18" "20" "22"; do
nvm use --global "${version}"
nvm use "${version}"
node --version
npm --version
pnpm --version
yarn --version
npm ls -g
done
if [ -n "${original_nvm_default}" ] && [ "${original_nvm_default}" != "none" ]; then
nvm alias default "${original_nvm_default}" >/dev/null
fi

echo "- Bun:"
bun --version
Expand Down