Skip to content
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

fix: set correct INSTALL_DIR for brew installation #1362

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
13 changes: 10 additions & 3 deletions .ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ set_filename() {
download_fnm() {
if [ "$USE_HOMEBREW" = "true" ]; then
brew install fnm
INSTALL_DIR="$(brew --prefix fnm)/bin"
else
if [ "$RELEASE" = "latest" ]; then
URL="https://github.com/Schniz/fnm/releases/latest/download/$FILENAME.zip"
Expand Down Expand Up @@ -173,7 +174,9 @@ setup_shell() {
echo '# fnm'
echo 'FNM_PATH="'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]; then'
echo ' export PATH="'$INSTALL_DIR':$PATH"'
if [ "$USE_HOMEBREW" != "true" ]; then
echo ' export PATH="$FNM_PATH:$PATH"'
fi
echo ' eval "`fnm env`"'
echo 'fi'
} | tee -a "$CONF_FILE"
Expand All @@ -187,7 +190,9 @@ setup_shell() {
echo '# fnm'
echo 'set FNM_PATH "'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]'
echo ' set PATH "$FNM_PATH" $PATH'
if [ "$USE_HOMEBREW" != "true" ]; then
echo ' set PATH "$FNM_PATH" $PATH'
fi
echo ' fnm env | source'
echo 'end'
} | tee -a "$CONF_FILE"
Expand All @@ -205,7 +210,9 @@ setup_shell() {
echo '# fnm'
echo 'FNM_PATH="'"$INSTALL_DIR"'"'
echo 'if [ -d "$FNM_PATH" ]; then'
echo ' export PATH="$FNM_PATH:$PATH"'
if [ "$USE_HOMEBREW" != "true" ]; then
echo ' export PATH="$FNM_PATH:$PATH"'
fi
echo ' eval "`fnm env`"'
echo 'fi'
} | tee -a "$CONF_FILE"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ curl -fsSL https://fnm.vercel.app/install | bash -s -- --skip-shell

Set a custom directory for fnm to be installed. The default is `$XDG_DATA_HOME/fnm` (if `$XDG_DATA_HOME` is not defined it falls back to `$HOME/.local/share/fnm` on linux and `$HOME/Library/Application Support/fnm` on MacOS).

> **Note:** On macOS, this option is only meaningful when using `--force-install` since Homebrew is the default installation method.

`--skip-shell`

Skip appending shell specific loader to shell config file, based on the current user shell, defined in `$SHELL`. e.g. for Bash, `$HOME/.bashrc`. `$HOME/.zshrc` for Zsh. For Fish - `$HOME/.config/fish/conf.d/fnm.fish`
Expand Down