32 lines
772 B
Bash
Executable file
32 lines
772 B
Bash
Executable file
#!/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" \
|
|
"(in case of minification issue, run 'rm -r dist/ target/')"
|
|
cargo run --release
|
|
}
|
|
|
|
main "$@"
|