Skip to content

Instantly share code, notes, and snippets.

@woodie
Last active December 27, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodie/b31ae19e9522fc3ed226 to your computer and use it in GitHub Desktop.
Save woodie/b31ae19e9522fc3ed226 to your computer and use it in GitHub Desktop.
I use this wrapper to run TypeScript files on-the-fly.
#!/usr/bin/env bash
TSFILE=${@##*/}
JSFILE=${TSFILE/%ts/js}
MD5DIR=`md5 -q ${@}`/
if [ ! -d $TMPDIR$MD5DIR ]; then
mkdir $TMPDIR$MD5DIR
fi
if [ ! -f $TMPDIR$MD5DIR$JSFILE ] || [ ${@} -nt $TMPDIR$MD5DIR$JSFILE ]; then
tsc --outDir $TMPDIR$MD5DIR ${@}
fi
node $TMPDIR$MD5DIR$JSFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment