diff --git a/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx.tmpl b/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx.tmpl index 936a7fa3..94bcb22f 100644 --- a/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx.tmpl +++ b/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx.tmpl @@ -32,10 +32,10 @@ if ! command -v volta > /dev/null; then fi export PATH="$VOLTA_HOME/bin:$PATH" logg 'Installing `node` via `volta`' - volta install node + volta install node@latest else if ! node --version > /dev/null; then - volta install node + volta install node@latest fi fi @@ -50,15 +50,4 @@ if ! command -v zx > /dev/null; then else logg '`zx` is already installed' fi - -### Ensure recent version of Node.js is being used -if command -v volta > /dev/null; then - if ! test "$(node --version | sed 's/^v//' | awk '{print $1}' | awk -F'.' ' ( $1 > 15) ')"; then - volta install node@latest - else - logg info 'Node.js appears to meet the minimum version requirements' - fi -else - logg warn 'Volta is not installed' -fi {{ end -}} \ No newline at end of file diff --git a/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_9-ensure-recent-nodejs-version b/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_9-ensure-recent-nodejs-version new file mode 100644 index 00000000..fec12050 --- /dev/null +++ b/.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_9-ensure-recent-nodejs-version @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +{{- if (ne .host.distro.family "windows") }} + +# Node.js version: {{ output "node" "--version" }} + +### Ensure recent version of Node.js is being used +if command -v volta > /dev/null; then + if ! test "$(node --version | sed 's/^v//' | awk '{print $1}' | awk -F'.' ' ( $1 > 15) ')"; then + logg info 'Installing latest version of Node.js' + volta install node@latest + else + logg info 'Node.js appears to meet the minimum version requirements (version >15)' + fi +else + logg warn 'Volta is not installed - skipping logic that ensures Node.js meets the version requirement of >15' +fi +{{ end -}} \ No newline at end of file