From fe0adf7813c1f4067f25a1eb7ffb47c1f589d3f8 Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Wed, 1 Feb 2023 16:58:31 +0000 Subject: [PATCH] Update 3 files - /home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl - /home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl --- .../run_onchange_before_08-install-zx.tmpl | 18 ++++++++++++++---- ...onchange_before_09-ensure-node-version.tmpl | 0 2 files changed, 14 insertions(+), 4 deletions(-) rename home/.chezmoiscripts/{_universal => universal}/run_onchange_before_09-ensure-node-version.tmpl (100%) diff --git a/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl index 605f41a0..6933b05d 100644 --- a/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl +++ b/home/.chezmoiscripts/universal/run_onchange_before_08-install-zx.tmpl @@ -16,14 +16,26 @@ else logg '`node` is available' fi -### Ensure volta is installed +### Ensure Volta is installed if ! command -v volta > /dev/null; then if command -v brew > /dev/null; then logg 'Installing `volta` via `brew`' brew install volta + else + logg warn '`brew` needs to be available to install Volta' fi +else + if ! node --version > /dev/null; then + volta install node@latest + fi +fi + +### Setup Volta +if command -v volta > /dev/null; then if [ -z "$VOLTA_HOME" ]; then volta setup + else + logg warn 'VOLTA_HOME is not defined' fi if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" @@ -34,9 +46,7 @@ if ! command -v volta > /dev/null; then logg 'Installing `node` via `volta`' volta install node@latest else - if ! node --version > /dev/null; then - volta install node@latest - fi + logg warn '`volta` needs to be installed' fi ### Ensure zx is installed diff --git a/home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl b/home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl similarity index 100% rename from home/.chezmoiscripts/_universal/run_onchange_before_09-ensure-node-version.tmpl rename to home/.chezmoiscripts/universal/run_onchange_before_09-ensure-node-version.tmpl