src/build.sh (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#!/bin/sh # default program name progname="onyx-scry" # or use first cmd line arg if [ ! -z "$1" ]; then progname=$1 fi if [ -e ${progname}.ts ]; then rm ${progname}.ts fi # build the source map and concatenate the source srcmap=$(mktemp) for f in *.ts; do lines=$(wc -l ${f}) set ${lines} lines=$1 echo "${f}\t${lines}" >> ${srcmap} cat ${f} >> ${progname}.ts done # generate temporary file for intermediate output errorOut=$(mktemp) # compile and write output to temporary file tsc --strict --target ES2015 --outFile ../static/${progname}.js ${progname}.ts | sed -e s/\(/:/ -e s/,/:/ -e s/\):// | nobs >> ${errorOut} # if sourcemapper panics you can uncomment this # cat ${errorOut} # translate lines into original source with the source map and output to stdout ../buildtools/sourcemapper ${errorOut} ${srcmap} # delete the temporary files rm ${errorOut} rm ${progname}.ts rm ${srcmap} |