Skip to content

Add shell integration support for asdf #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
11 changes: 10 additions & 1 deletion shell/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ get_vanilla_product_path() (
if [[ -z "\$NODE_SAFE_VANILLA_NODE_PATH" ]]; then
# nvm can change the path of the node binary om the fly, hence it takes precedence if set
[[ -n "\$NVM_BIN" ]] && NODE_SAFE_VANILLA_NODE_PATH="\$NVM_BIN/node"
if command -v asdf > /dev/null && [[ -n "\$ASDF_DIR" ]]; then
[[ -n "\$NODE_SAFE_DEBUG_SANDBOX" ]] && echo "node-safe (shell): getting node path from asdf"
NODE_SAFE_VANILLA_NODE_PATH="\$(asdf which node)"
fi
fi
if [[ -z "\$NODE_SAFE_VANILLA_NODE_PATH" ]]; then
# get the vanilla node from the other PATH entries, ignoring our own directory
Expand Down Expand Up @@ -137,7 +141,12 @@ do
done

# Store reference to the original node binary for faster lookups later
export NODE_SAFE_VANILLA_NODE_PATH=$(which node)
if command -v asdf > /dev/null && [[ -n "$ASDF_DIR" ]]; then
NODE_SAFE_VANILLA_NODE_PATH=$(asdf which node)
else
NODE_SAFE_VANILLA_NODE_PATH=$(which node)
fi
export NODE_SAFE_VANILLA_NODE_PATH
[[ -z "$NODE_SAFE_DIR" ]] && export NODE_SAFE_DIR="$CURRENT_DIR"

# Prepend the path with our bin directory so we get called when e.g. node is executed
Expand Down