mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-30 20:33:14 +01:00
perf(nvm): skip resolution for an already-active exact version
This commit is contained in:
1 parent
7140fedbfa
commit
c40910d039
2 files changed
+163
No files matched your search
@@ -50,6 +50,16 @@ function _omz_nvm_setup_autoload {
|
||||
zstyle -t ':omz:plugins:nvm' silent-autoload && nvm_silent="--silent"
|
||||
|
||||
if [[ -n "$nvmrc_path" ]]; then
|
||||
# Skip version resolution when an exact, unaliased version is already active.
|
||||
local nvmrc_version="$(<"$nvmrc_path")"
|
||||
if [[ "$nvmrc_version" == v<->.<->.<-> \
|
||||
&& ! -e "$NVM_DIR/alias/$nvmrc_version" \
|
||||
&& "${commands[node]-}" == "$NVM_DIR/versions/node/$nvmrc_version/bin/node" \
|
||||
&& -x "${commands[node]-}" ]] \
|
||||
&& (( ! $+functions[node] && ! $+aliases[node] )) \
|
||||
&& [[ "$nvmrc_version" == "$(command node --version 2>/dev/null)" ]]; then
|
||||
return
|
||||
fi
|
||||
local nvmrc_node_version=$(nvm version $(command cat "$nvmrc_path" | tr -dc '[:print:]'))
|
||||
|
||||
if [[ "$nvmrc_node_version" = "N/A" ]]; then
|
||||
|
||||
Reference in new issue
Block a user