set -e
REPO_ROOT="${BASH_SOURCE%/*}"
-DENO_BASE="$REPO_ROOT/vendor/deno"
-DENO_INSTALLER="$DENO_BASE/install.sh"
-DENO_INSTALL="$DENO_BASE/local"
-DENO_EXE="$DENO_INSTALL/bin/deno"
-DENO_TYPES="$DENO_BASE/types.d.ts"
+MAIN_EXE="$REPO_ROOT/lib/main.js"
+VENDOR_ROOT="$REPO_ROOT/vendor"
+N_EXE="$VENDOR_ROOT/n/bin/n"
+N_PREFIX="$VENDOR_ROOT/node"
+YARN_EXE="$VENDOR_ROOT/yarn-v1.22.4/bin/yarn"
+
+export N_PREFIX
for ARG in "$@"; do
if [ "$ARG" = "--force" -o "$ARG" = "-f" ]; then
fi
done
-if [[ ! -e "$DENO_INSTALLER" || $FORCE ]]; then
- echo "[status] Fetching Deno installer"
- command curl -fsSL -o "$DENO_INSTALLER" https://deno.land/x/install/install.sh
-else
- echo "[skip] Fetch Deno installer; use -f to force re-fetch"
+if [[ ! -x $N_EXE ]]; then
+ echo "[abort] No executable at $N_EXE; did you forget to \`git submodule init\`?"
+ exit 1
fi
-if [[ ! -e "$DENO_EXE" || $FORCE ]]; then
- echo "[status] Run Deno installer"
- export DENO_INSTALL
- command sh "$DENO_INSTALLER"
-else
- echo "[skip] Run Deno installer; use -f to force re-install"
+if ! "$N_EXE" which lts &> /dev/null; then
+ echo "[status] Installing Node LTS version"
+ "$N_EXE" lts
fi
-if [[ ! -e "$DENO_TYPES" || $FORCE ]]; then
- echo "[status] Generate Deno types"
- "$DENO_EXE" types > "$DENO_TYPES"
-else
- echo "[skip] Generate Deno types; use -f to force re-generation"
-fi
+echo "[status] Installing TypeScript"
+
+"$N_EXE" exec lts "$YARN_EXE" --frozen-lockfile --no-default-rc --no-progress --silent
+
+echo "[status] Building"
+
+"$N_EXE" exec lts "$YARN_EXE" run --silent tsc
echo "[status] Running main"
-"$DENO_EXE" run --allow-all lib/main.ts "$@"
+
+"$N_EXE" run lts "$MAIN_EXE" "$@"
--- /dev/null
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+"@types/node@*":
+ version "13.9.2"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.2.tgz#ace1880c03594cc3e80206d96847157d8e7fa349"
+ integrity sha512-bnoqK579sAYrQbp73wwglccjJ4sfRdKU7WNEZ5FW4K2U6Kc0/eZ5kvXG0JKsEKFB50zrFmfFt52/cvBbZa7eXg==
+
+typescript@3.8.3:
+ version "3.8.3"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
+ integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==