]> git.wincent.com - wincent.git/blob - bin/n
refactor(fig): use Node v13 so that we can ES modules natively
[wincent.git] / bin / n
1 #!/bin/bash
2
3 set -e
4
5 REPO_ROOT="${BASH_SOURCE%/*}/.."
6
7 source "$REPO_ROOT/bin/common"
8
9 VENDOR_ROOT="$REPO_ROOT/vendor"
10 N_EXE="$VENDOR_ROOT/n/bin/n"
11 N_PREFIX="$VENDOR_ROOT/node"
12
13 export N_PREFIX
14
15 if [[ ! -x $N_EXE ]]; then
16   log_error "No executable at $N_EXE; did you forget to \`git submodule update\`?"
17   exit 1
18 fi
19
20 if ! "$N_EXE" which latest &> /dev/null; then
21   log_info "Installing Node latest version"
22   "$N_EXE" latest
23 else
24   log_debug "Using Node latest installation"
25 fi
26
27 "$N_EXE" "$@"