You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
738 B

#!/usr/bin/env bash
### CONFIGURATION ###
BUILD_ENTRY_POINT="index.ts"
BUILD_DENO_PATH="$(which deno)"
BUILD_DENO_FLAGS="--unstable --allow-read --allow-env --allow-net"
BUILD_DENO_BINARY="application.bin"
### BUILD SCRIPT ###
rm -rf build "$BUILD_DENO_BINARY"
mkdir build
cp "$BUILD_DENO_PATH" build
deno bundle -c ./tsconfig.json --unstable --importmap=./import-map.json "./${BUILD_ENTRY_POINT}" build/bundle.js
cp ./tsconfig.json build/tsconfig.json
echo "#!/bin/sh" > build/launch
echo 'DIR="$(cd "$(dirname "$0")" ; pwd -P)"' >> build/launch
echo "exec \$DIR/deno run $BUILD_DENO_FLAGS \$DIR/bundle.js \$@" >> build/launch
chmod +x build/launch
warp-packer -a linux-x64 -i build -e launch -o "$BUILD_DENO_BINARY"
rm -rf build