diff --git a/bootstrap.sh b/bootstrap.sh index b72e644..9c1dc14 100644 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -12,12 +12,13 @@ fi # Ensuring steps are defined. . ./steps.sh -TOTAL_STEPS=4 +TOTAL_STEPS=5 # Refer to steps.sh for step definition. bootstrap() { ensure_apt_up_to_date ensure_apt_dependencies + ensure_nvm inject_shell_configuration inject_vim_configuration } diff --git a/steps.sh b/steps.sh index e9f3b5d..d7c5fec 100644 --- a/steps.sh +++ b/steps.sh @@ -38,6 +38,16 @@ ensure_apt_dependencies() { fi } +ensure_nvm() { + pre_step "Installing nvm to manage node version" + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash + + # Ensuring that nvm is usable right away without restarting the shell + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" +} + # Injects a managed block in the shell configuration. inject_shell_configuration() { pre_step "Injecting managed block in shell configuration"