Skip to content

Commit

Permalink
feat: create seed version of "install-next" script
Browse files Browse the repository at this point in the history
Just playing around at this point to see if I could make something that
was very close to zero-dependencies (other than the language runtime and
its standard library), unlike Ansible, which sits atop pile of Python
infrastructure.

Related: #82
  • Loading branch information
wincent committed Mar 17, 2020
1 parent 2f49381 commit 29c93da
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
41 changes: 41 additions & 0 deletions install-next
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

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"

for ARG in "$@"; do
if [ "$ARG" = "--force" -o "$ARG" = "-f" ]; then
FORCE=1
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"
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"
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] Running main"
"$DENO_EXE" run --allow-all lib/main.ts "$@"
4 changes: 4 additions & 0 deletions lib/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// This is only for the benefit of the LanguageClient.
import type Deno from '../vendor/deno/types.d.ts';

console.log(Deno.args);
Empty file added tsconfig.json
Empty file.
2 changes: 2 additions & 0 deletions vendor/deno/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!/.gitignore

0 comments on commit 29c93da

Please sign in to comment.