3 # "This is too simple" you say! "Where is the magic!?" you ask.
5 # The custom functions for node are here.
6 # The generic functions - version checks, download, extract, etc - are here:
7 # - https://github.com/webinstall/packages/branches/master/_webi/template.sh
15 pkg_get_current_version() {
16 # 'node --version' has output in this format:
18 # This trims it down to just the version number:
20 echo "$(node --version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')"
24 # mkdir -p $HOME/.local/opt
25 mkdir -p "$(dirname $pkg_src)"
27 # mv ./node* "$HOME/.local/opt/node-v14.4.0"
28 mv ./"$pkg_cmd_name"* "$pkg_src"
32 # rm -f "$HOME/.local/opt/node"
35 # ln -s "$HOME/.local/opt/node-v14.4.0" "$HOME/.local/opt/node"
36 ln -s "$pkg_src" "$pkg_dst"
38 # Node bugfix: use the correct version of node, even if PATH has a conflict
39 "$pkg_src"/bin/node "$pkg_src"/bin/npm config set scripts-prepend-node-path=true
43 echo "Installed 'node' and 'npm' at $pkg_dst"