mostly update comments, fix gitea releases.js
[webi-installers/.git] / node / install.bash
index 4dba6c3b0c45441542fe44208dbcdf51b10310c0..15feaf8db392a2d0ac7029b1b996aae6f9c93e13 100644 (file)
 set -e
 set -u
 
+pkg_cmd_name="node"
+
 pkg_get_current_version() {
     # 'node --version' has output in this format:
     #       v12.8.0
     # This trims it down to just the version number:
     #       12.8.0
-    echo "$(node --version 2>/dev/null | sed 's:^v::')"
+    echo "$(node --version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
 }
 
 pkg_format_cmd_version() {
@@ -119,8 +121,16 @@ pkg_install() {
 
         # rename the entire extracted folder to the new location
         # (this will be "$HOME/.local/opt/node-v$WEBI_VERSION" by default)
+
+        # ex (full directory): ./node-v13-linux-amd64/bin/node.exe
         mv ./"$pkg_cmd_name"* "$pkg_new_opt"
 
+        # ex (single file): ./caddy-v13-linux-amd64.exe
+        #mv ./"$pkg_cmd_name"* "$pkg_common_cmd"
+
+        # ex (single file, nested in directory): ./rg/rg-v13-linux-amd64
+        #mv ./"$pkg_cmd_name"*/"$pkg_cmd_name"* "$pkg_commend_cmd"
+
     popd 2>&1 >/dev/null
 }