-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Use NVM for Node instead of brew #11
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,13 @@ brew_uninstall() { | |
fi | ||
} | ||
|
||
brew_cleanup() { | ||
if brew_is_installed "$1"; then | ||
fancy_echo "Cleaning up %s ..." "$1" | ||
brew cleanup "$@" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we replace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I notice 2 different references for the parameter |
||
fi | ||
} | ||
|
||
brew_install_or_upgrade() { | ||
if brew_is_installed "$1"; then | ||
if brew_is_upgradable "$1"; then | ||
|
@@ -153,14 +160,30 @@ brew_tap 'caskroom/cask' | |
########################### | ||
# NODEJS | ||
########################## | ||
|
||
# Install NVM | ||
if ! command -v nvm >/dev/null; then | ||
fancy_echo "Installing NVM ..." | ||
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | $SHELL | ||
|
||
# Load NVM | ||
export NVM_DIR="$HOME/.nvm" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
else | ||
fancy_echo "NVM already installed. Skipping ..."bash "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the |
||
fi | ||
|
||
nodeversions=`./node-versions.rb` | ||
mostrecentnode=$(echo "${nodeversions[@]:-1:1}" | tail -1) | ||
|
||
# Install each versions | ||
# Iterate over LTS Node versions | ||
for version in $nodeversions; do | ||
brew_install_or_upgrade $version | ||
brew_cleanup node@$version | ||
nvm install $version | ||
done | ||
|
||
nvm alias default $mostrecentnode | ||
|
||
# Link the last, most recent version | ||
brew unlink $mostrecentnode | ||
brew link --force $mostrecentnode | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍