Update 2 files

- /.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_9-ensure-recent-nodejs-version
- /.local/share/chezmoi/home/.chezmoiscripts/_universal/run_onchange_before_8-install-zx.tmpl
This commit is contained in:
Brian Zalewski 2022-12-24 10:46:21 +00:00
parent 8f46c02426
commit 60f3e4cc1d
2 changed files with 19 additions and 13 deletions

View file

@ -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 -}}

View file

@ -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 -}}