1 | #!/bin/bash
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | set -e
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | unset PREFIX
|
23 |
|
24 |
|
25 | HOMEBREW_APPLE_SILICON_BIN=/opt/homebrew/bin
|
26 | if [[ -d $HOMEBREW_APPLE_SILICON_BIN && ! $PATH =~ $HOMEBREW_APPLE_SILICON_BIN ]]; then
|
27 | export PATH="$HOMEBREW_APPLE_SILICON_BIN:$PATH"
|
28 | fi
|
29 |
|
30 |
|
31 | [ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm"
|
32 |
|
33 |
|
34 |
|
35 | if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
|
36 |
|
37 | . "$HOME/.nvm/nvm.sh" --no-use
|
38 | nvm use 2> /dev/null || nvm use default
|
39 | elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
|
40 |
|
41 | . "$(brew --prefix nvm)/nvm.sh" --no-use
|
42 | nvm use 2> /dev/null || nvm use default
|
43 | fi
|
44 |
|
45 |
|
46 | if [[ -x "$HOME/.nodenv/bin/nodenv" ]]; then
|
47 | eval "$("$HOME/.nodenv/bin/nodenv" init -)"
|
48 | elif [[ -x "$(command -v brew)" && -x "$(brew --prefix nodenv)/bin/nodenv" ]]; then
|
49 | eval "$("$(brew --prefix nodenv)/bin/nodenv" init -)"
|
50 | fi
|
51 |
|
52 | # Set up the ndenv of anyenv if preset
|
53 | if [[ ! -x node && -d ${HOME}/.anyenv/bin ]]; then
|
54 | export PATH=${HOME}/.anyenv/bin:${PATH}
|
55 | if [[ "$(anyenv envs | grep -c ndenv )" -eq 1 ]]; then
|
56 | eval "$(anyenv init -)"
|
57 | fi
|
58 | fi
|
59 |
|
60 | # Set up asdf-vm if present
|
61 | if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
62 | # shellcheck source=/dev/null
|
63 | . "$ASDF_DIR/asdf.sh"
|
64 | elif [[ -f "$HOME/.asdf/asdf.sh" ]]; then
|
65 | # shellcheck source=/dev/null
|
66 | . "$HOME/.asdf/asdf.sh"
|
67 | elif [[ -x "$(command -v brew)" && -f "$(brew --prefix asdf)/asdf.sh" ]]; then
|
68 | # shellcheck source=/dev/null
|
69 | . "$(brew --prefix asdf)/asdf.sh"
|
70 | fi
|
71 |
|
72 | # Set up volta if present
|
73 | if [[ -x "$HOME/.volta/bin/node" ]]; then
|
74 | export VOLTA_HOME="$HOME/.volta"
|
75 | export PATH="$VOLTA_HOME/bin:$PATH"
|
76 | fi
|
77 |
|
78 | # Set up the fnm node version manager if present
|
79 | if [[ -x "$HOME/.fnm/fnm" ]]; then
|
80 | eval "$("$HOME/.fnm/fnm" env)"
|
81 | elif [[ -x "$(command -v brew)" && -x "$(brew --prefix fnm)/bin/fnm" ]]; then
|
82 | eval "$("$(brew --prefix fnm)/bin/fnm" env)"
|
83 | fi
|
84 |
|
\ | No newline at end of file |