mylloon.fr/run.sh

33 lines
772 B
Bash
Raw Normal View History

2023-04-09 17:59:18 +02:00
#!/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
2023-04-09 18:03:03 +02:00
echo "Run the app" \
"(in case of minification issue, run 'rm -r dist/ target/')"
2023-04-09 17:59:18 +02:00
cargo run --release
}
main "$@"