From b7a3f7263bb56f409887ddea275ce8fa726000a8 Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 17 Feb 2023 10:17:48 +1100 Subject: [PATCH] Add script to install current node version The API is conveniently exactly the same as rbenv. --- script/nodenv-install.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 script/nodenv-install.sh diff --git a/script/nodenv-install.sh b/script/nodenv-install.sh new file mode 100755 index 0000000000..f8bcf33f58 --- /dev/null +++ b/script/nodenv-install.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# Install our selected Node version defined in the .node-version file. +# +# If our node-build version is outdated and it can't build the version we want +# then we try upgrading node-build and installing again. + +if nodenv install --skip-existing; then + echo "Correct Node version is installed." +else + echo "Upgrading node-build:" + git -C "$(nodenv root)"/plugins/node-build pull + + nodenv install +fi