From eea2d7e9ac2d8e2a2e6dae31d5776c4437a0ae83 Mon Sep 17 00:00:00 2001
From: tteckster <tteckster@gmail.com>
Date: Mon, 26 Jun 2023 13:19:53 -0400
Subject: [PATCH] Code refactoring

---
 install/dashy-install.sh    | 12 +++++++-----
 install/homepage-install.sh |  9 ++++-----
 install/nocodb-install.sh   | 12 +++++++-----
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/install/dashy-install.sh b/install/dashy-install.sh
index 6bb812f7..50078550 100644
--- a/install/dashy-install.sh
+++ b/install/dashy-install.sh
@@ -18,14 +18,16 @@ $STD apt-get install -y curl
 $STD apt-get install -y sudo
 $STD apt-get install -y mc
 $STD apt-get install -y git
+$STD apt-get install -y make
+$STD apt-get install -y g++
+$STD apt-get install -y gcc
 msg_ok "Installed Dependencies"
 
-msg_info "Setting up Node.js Repository"
-$STD bash <(curl -fsSL https://deb.nodesource.com/setup_16.x)
-msg_ok "Set up Node.js Repository"
-
 msg_info "Installing Node.js"
-$STD apt-get install -y nodejs git make g++ gcc
+$STD bash <(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh)
+. ~/.bashrc
+$STD nvm install 16.20.1
+ln -sf /root/.nvm/versions/node/v16.20.1/bin/node /usr/bin/node
 msg_ok "Installed Node.js"
 
 msg_info "Installing Yarn"
diff --git a/install/homepage-install.sh b/install/homepage-install.sh
index 3f5c85d9..129195e4 100644
--- a/install/homepage-install.sh
+++ b/install/homepage-install.sh
@@ -20,12 +20,11 @@ $STD apt-get install -y mc
 $STD apt-get install -y git
 msg_ok "Installed Dependencies"
 
-msg_info "Setting up Node.js Repository"
-$STD bash <(curl -fsSL https://deb.nodesource.com/setup_16.x)
-msg_ok "Set up Node.js Repository"
-
 msg_info "Installing Node.js"
-$STD apt-get install -y nodejs
+$STD bash <(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh)
+. ~/.bashrc
+$STD nvm install 16.20.1
+ln -sf /root/.nvm/versions/node/v16.20.1/bin/node /usr/bin/node
 $STD npm install -g pnpm
 msg_ok "Installed Node.js"
 
diff --git a/install/nocodb-install.sh b/install/nocodb-install.sh
index 8435fc06..23713d69 100644
--- a/install/nocodb-install.sh
+++ b/install/nocodb-install.sh
@@ -18,14 +18,16 @@ $STD apt-get install -y curl
 $STD apt-get install -y sudo
 $STD apt-get install -y mc
 $STD apt-get install -y git
+$STD apt-get install -y make
+$STD apt-get install -y g++
+$STD apt-get install -y gcc
 msg_ok "Installed Dependencies"
 
-msg_info "Setting up Node.js Repository"
-$STD bash <(curl -fsSL https://deb.nodesource.com/setup_16.x)
-msg_ok "Set up Node.js Repository"
-
 msg_info "Installing Node.js"
-$STD sudo apt-get install -y nodejs git make g++ gcc
+$STD bash <(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh)
+. ~/.bashrc
+$STD nvm install 16.20.1
+ln -sf /root/.nvm/versions/node/v16.20.1/bin/node /usr/bin/node
 msg_ok "Installed Node.js"
 
 msg_info "Installing NocoDB"