install.fairie/home/dot_local/bin/post-installx/executable_post-volta.sh
Brian Zalewski 2731e1121b Latest
2024-05-28 03:45:14 +00:00

26 lines
890 B
Bash

#!/usr/bin/env bash
# @file Volta initialization
# @brief This script initializes Volta and ensures the latest version of node and yarn are installed
set -Eeuo pipefail
trap "logg error 'Script encountered an error!'" ERR
export VOLTA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/volta"
export PATH="$VOLTA_HOME/bin:$PATH"
### Disconnect from CloudFlare WARP (if connected)
if command -v warp-cli > /dev/null; then
warp-cli disconnect && logg info 'CloudFlare WARP temporarily disconnected while Volta installs Node / Yarn'
fi
### Configure Volta if it is installed
if command -v volta > /dev/null; then
logg info 'Running volta setup'
volta setup
logg info 'Installing latest version of Node.js via Volta'
volta install node@latest
logg info 'Installing latest version of Yarn via Volta'
volta install yarn@latest
else
logg info 'Volta is not installed'
fi