Skip to content

Commit

Permalink
💥 Switch from using nvm to using Volta
Browse files Browse the repository at this point in the history
  • Loading branch information
alrra committed Sep 5, 2023
1 parent 55f72e3 commit cc1cf11
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 105 deletions.
2 changes: 1 addition & 1 deletion src/os/installs/macos/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \
./bash.sh

./git.sh
./../nvm.sh
./../volta.sh
./browsers.sh
./compression_tools.sh
./gpg.sh
Expand Down
5 changes: 1 addition & 4 deletions src/os/installs/macos/misc_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,4 @@ cd "$(dirname "${BASH_SOURCE[0]}")" \
print_in_purple "\n Miscellaneous Tools\n\n"

brew_install "ShellCheck" "shellcheck"

if [ -d "$HOME/.nvm" ]; then
brew_install "Yarn" "yarn"
fi
brew_install "Yarn" "yarn"
87 changes: 0 additions & 87 deletions src/os/installs/nvm.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/os/installs/ubuntu/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ upgrade
./build-essentials.sh

./git.sh
./../nvm.sh
./browsers.sh
./compression_tools.sh
./image_tools.sh
./misc.sh
./misc_tools.sh
./../volta.sh
./../npm.sh
./tmux.sh
./../vim.sh
Expand Down
21 changes: 9 additions & 12 deletions src/os/installs/ubuntu/misc_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@ install_package "cURL" "curl"
install_package "ShellCheck" "shellcheck"
install_package "xclip" "xclip"

if [ -d "$HOME/.nvm" ]; then
if ! package_is_installed "yarn"; then

if ! package_is_installed "yarn"; then
add_key "https://dl.yarnpkg.com/debian/pubkey.gpg" \
|| print_error "Yarn (add key)"

add_key "https://dl.yarnpkg.com/debian/pubkey.gpg" \
|| print_error "Yarn (add key)"
add_to_source_list "https://dl.yarnpkg.com/debian/ stable main" "yarn.list" \
|| print_error "Yarn (add to package resource list)"

add_to_source_list "https://dl.yarnpkg.com/debian/ stable main" "yarn.list" \
|| print_error "Yarn (add to package resource list)"
update &> /dev/null \
|| print_error "Yarn (resync package index files)"

update &> /dev/null \
|| print_error "Yarn (resync package index files)"

fi

install_package "Yarn" "yarn" "--no-install-recommends"
fi

install_package "Yarn" "yarn" "--no-install-recommends"
63 changes: 63 additions & 0 deletions src/os/installs/volta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

cd "$(dirname "${BASH_SOURCE[0]}")" \
&& . "../utils.sh"

declare -r LOCAL_SHELL_CONFIG_FILE="$HOME/.bash.local"

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

add_configs() {

# Check if the configs need to be added.

. "$LOCAL_SHELL_CONFIG_FILE"

if command -v volta &> /dev/null; then
return
fi

declare -r CONFIGS="
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Volta
export PATH=\"\$HOME/.volta/bin:\$PATH\"
"

execute \
"printf '%s' '$CONFIGS' >> $LOCAL_SHELL_CONFIG_FILE" \
"Update $LOCAL_SHELL_CONFIG_FILE"

}

install() {
execute \
"curl https://get.volta.sh | bash -s -- --skip-setup" \
"Install"
}

install_latest_stable_node() {

# Install the latest stable version of Node
# (this will also set it as the default).

execute \
". $LOCAL_SHELL_CONFIG_FILE && \
volta install node" \
"Install Node LTS"
}

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

main() {

print_in_purple "\n Volta\n\n"

install
add_configs
install_latest_stable_node

}

main

0 comments on commit cc1cf11

Please sign in to comment.