| SRCDIR=$(readlink --canonicalize $(dirname $0)) |
| DSTDIR=$(mktemp --directory --tmpdir $(basename $0).XXXXXXXXXX) |
| if [[ ${UID} -ne 0 ]]; then |
| echo -e '\033[1;31m' "** The ${PWD}/deploy directory exists! Refusing to clobber it! **" '\033[0m' |
| sudo docker run -i -t --pull always --rm -v ${SRCDIR}/..:/src -v ${PWD}:/dst emscripten/emsdk /src/app/$(basename $0) |
| wget -O ${BAZEL} https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_RELEASE}/bazelisk-linux-amd64 |
| # Emscripten doesn't support `-fstack-protector`. |
| ${BAZEL} build --compilation_mode=opt \ |
| --copt=-fno-stack-protector \ |
| cp ../bazel-bin/app/_re2.js ${DSTDIR} |
| # Clean up the sundry Bazel output directories. |
| cp app.ts index.html _re2.d.ts ${DSTDIR} |
| cp package.json rollup.config.js tsconfig.json ${DSTDIR} |
| npx rollup -c rollup.config.js -d deploy |