From 2c44b81122cc2951175f9301ac38a4f6a3ed47bf Mon Sep 17 00:00:00 2001 From: Max Martyn Date: Fri, 5 Feb 2021 11:40:39 +0200 Subject: [PATCH 1/6] Remov global npm packages installation --- web.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/web.sh b/web.sh index 979b286..8c501af 100755 --- a/web.sh +++ b/web.sh @@ -22,7 +22,3 @@ brew install node@8 # Remove outdated versions from the cellar. brew cleanup - -npm install -g grunt-cli -npm install -g jshint -npm install -g serverless From f17470449e3e8d0449b7dd335f2728134a46a5fe Mon Sep 17 00:00:00 2001 From: Max Martyn Date: Fri, 5 Feb 2021 13:40:51 +0200 Subject: [PATCH 2/6] Rework Node installation --- web.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/web.sh b/web.sh index 8c501af..d23660b 100755 --- a/web.sh +++ b/web.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Install command-line tools using Homebrew. +# Install tooling needed for Front End developers. # Ask for the administrator password upfront. sudo -v @@ -8,17 +8,21 @@ sudo -v # Keep-alive: update existing `sudo` time stamp until the script has finished. while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & -# Check for Homebrew, -# Install if we don't have it -if test ! $(which brew); then - echo "Installing homebrew..." - ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -fi +# Download and install nvm - Node version manager +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash -# Make sure we’re using the latest Homebrew. -brew update +# Run nvm +. ~/.nvm/nvm.sh -brew install node@8 +# Install and use lts Node release +nvm install --lts -# Remove outdated versions from the cellar. -brew cleanup +echo "\nLatest Node lts released installed." + +echo " +Note! + +Please switch to propper Node version when starting working on frontend service. +Currently it is explicitly set in Dockerfile in each service. +.nmvrc files would be added for easy one line version switch in nearest future. +" \ No newline at end of file From 3473ad645346649157e857d67c75292519cfbf6e Mon Sep 17 00:00:00 2001 From: Max Martyn Date: Wed, 10 Feb 2021 12:27:51 +0200 Subject: [PATCH 3/6] Revert "Rework Node installation" This reverts commit f17470449e3e8d0449b7dd335f2728134a46a5fe. --- web.sh | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/web.sh b/web.sh index d23660b..8c501af 100755 --- a/web.sh +++ b/web.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Install tooling needed for Front End developers. +# Install command-line tools using Homebrew. # Ask for the administrator password upfront. sudo -v @@ -8,21 +8,17 @@ sudo -v # Keep-alive: update existing `sudo` time stamp until the script has finished. while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & -# Download and install nvm - Node version manager -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash +# Check for Homebrew, +# Install if we don't have it +if test ! $(which brew); then + echo "Installing homebrew..." + ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +fi -# Run nvm -. ~/.nvm/nvm.sh +# Make sure we’re using the latest Homebrew. +brew update -# Install and use lts Node release -nvm install --lts +brew install node@8 -echo "\nLatest Node lts released installed." - -echo " -Note! - -Please switch to propper Node version when starting working on frontend service. -Currently it is explicitly set in Dockerfile in each service. -.nmvrc files would be added for easy one line version switch in nearest future. -" \ No newline at end of file +# Remove outdated versions from the cellar. +brew cleanup From f8d3fd4b2381c6fd08ecc9ee3719d8bd787bde7f Mon Sep 17 00:00:00 2001 From: Max Martyn Date: Fri, 12 Feb 2021 10:26:39 +0200 Subject: [PATCH 4/6] Install nvm with brew --- web.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/web.sh b/web.sh index 8c501af..77dc89d 100755 --- a/web.sh +++ b/web.sh @@ -6,7 +6,7 @@ sudo -v # Keep-alive: update existing `sudo` time stamp until the script has finished. -while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & +# while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & # Check for Homebrew, # Install if we don't have it @@ -18,7 +18,27 @@ fi # Make sure we’re using the latest Homebrew. brew update -brew install node@8 +# Install and setup nvm - Node Version Manager +brew install nvm + +mkdir ~/.nvm + +# NVM setup +export NVM_DIR="$HOME/.nvm" +[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm +[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion + +# Install lts release of Node +nvm install --lts + +# Adding all nvm related variables to .zshrc +# If we add them in "NVM setup" step and "source .zshrc" the script will crash. +echo " +export NVM_DIR="$HOME/.nvm" +[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm +[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm"" >> ~/.zshrc # Remove outdated versions from the cellar. brew cleanup + +exec zsh \ No newline at end of file From 3829bfc39ac56aff5845d6671c328525fefc8897 Mon Sep 17 00:00:00 2001 From: Max Martyn Date: Fri, 12 Feb 2021 10:29:02 +0200 Subject: [PATCH 5/6] Uncomment Keep-alive part --- web.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web.sh b/web.sh index 77dc89d..eb5927a 100755 --- a/web.sh +++ b/web.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -# Install command-line tools using Homebrew. +# Install nvm and Node using Homebrew. # Ask for the administrator password upfront. sudo -v # Keep-alive: update existing `sudo` time stamp until the script has finished. -# while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & +while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & # Check for Homebrew, # Install if we don't have it From b13db3fa7bb33a97cb3bc90065500428ef3ed683 Mon Sep 17 00:00:00 2001 From: Max Martyn Date: Fri, 12 Feb 2021 12:09:19 +0200 Subject: [PATCH 6/6] Change Node version from lts to version used across our frontend projects --- web.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web.sh b/web.sh index eb5927a..bdffdf6 100755 --- a/web.sh +++ b/web.sh @@ -29,7 +29,7 @@ export NVM_DIR="$HOME/.nvm" [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion # Install lts release of Node -nvm install --lts +nvm install 12.6.2 # Adding all nvm related variables to .zshrc # If we add them in "NVM setup" step and "source .zshrc" the script will crash.