Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion nvm-exec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
Copy link
Member

Choose a reason for hiding this comment

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

could this be considered a breaking change if someone's relying on the lack of realpath here, wrt symlinks?


unset NVM_CD_FLAGS

Expand Down
8 changes: 7 additions & 1 deletion nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4075,8 +4075,14 @@ nvm() {
nvm_echo "Running node ${VERSION}$(nvm use --silent "${VERSION}" && nvm_print_npm_version)"
fi
fi
NODE_VERSION="${VERSION}" "${NVM_DIR}/nvm-exec" "$@"

NVM_EXEC="${NVM_DIR}/nvm-exec"
if [ ! -f "${NVM_EXEC}" ]; then
NVM_EXEC="$(dirname "${BASH_SOURCE[0]-}")/nvm-exec"
Copy link
Member

Choose a reason for hiding this comment

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

i think this needs to be reworked given 19f452b / #3499.

fi
NODE_VERSION="${VERSION}" "${NVM_EXEC}" "$@"
;;

"ls" | "list")
local PATTERN
local NVM_NO_COLORS
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

set -ex

die () { echo "$@" ; exit 1; }

INSTPATH="$(mktemp -p "$(pwd)" -d)"
trap 'test ! -z "${INSTPATH-}" && test -d "$INSTPATH" && rm -rf "$INSTPATH"' EXIT
declare -x NVM_DIR=$INSTPATH
\. ../../../nvm.sh

nvm install --lts || die 'nvm install --lts failed'
nvm exec --lts npm --version || die "`nvm exec` failed to run"
declare -x NODE_VERSION="$(nvm exec --lts --silent node --version)"

ln -s ../../../../nvm-exec "$INSTPATH/nvm-exec" || die "failed to create a symlink to $INSTPATH/"
"$INSTPATH/nvm-exec" npm ls > /dev/null || die "`nvm exec` failed to run using nvm-exec helper"

Loading