feat: macos and brew install support

This commit is contained in:
Andrejus Kostarevas
2024-01-25 00:27:04 +00:00
parent 62e6c0243e
commit 61fb58e90c
15 changed files with 148 additions and 45 deletions

View File

@@ -1,22 +1,33 @@
#!/usr/bin/env bash
nvm_version="v0.38.0"
# -----------------------------------------------------------------------------
# Description:
# Configure Node.js.
#
nvm_version="0.39.7"
if ! bin_in_path "nvm"; then
download_run "https://raw.githubusercontent.com/nvm-sh/nvm/${nvm_version}/install.sh" \
download_run "https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh" \
"bash"
fi
NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
nvm --version
nvm alias default lts/fermium
nvm install lts/fermium
nvm use lts/fermium
nvm alias default lts/iron
nvm install lts/iron
nvm use lts/iron
node --version
yarn --version
for dep in $(jq -r ".node_dependencies[]" $CONFIG); do
yarn global add $dep
yarn global upgrade $dep
done
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
for dep in $(jq -r ".node_dependencies[]" $CONFIG); do
yarn global add $dep
yarn global upgrade $dep
done
fi
unset nvm_version