#!/usr/bin/env bash set -o errexit # crash the script when a command crash set -o pipefail # same as above for piped command set -o nounset # crash when a variable doesnt exist # TRACE=1 for debug if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi cd "$(dirname "$0")" # change script directory main() { dir_dist="./dist" dir_template="/templates" if [ ! -d "$dir_dist$dir_template" ]; then echo "Copy template to dist directory" mkdir -p "$dir_dist$dir_template" cp -r ".$dir_template" "$dir_dist" echo "Generate minified templates" cargo run --release -- --no-http fi echo "Run the app" cargo run --release } main "$@"