43 lines
1.0 KiB
Bash
Executable File
43 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build the whole project: Svelte frontend + Rust backend.
|
|
#
|
|
# Usage:
|
|
# bash scripts/build.sh # release build
|
|
# bash scripts/build.sh --debug # debug build (faster)
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
PROFILE="release"
|
|
|
|
if [[ "${1:-}" == "--debug" ]]; then
|
|
PROFILE="debug"
|
|
fi
|
|
|
|
command -v cargo >/dev/null 2>&1 || { echo "cargo (Rust) est requis." >&2; exit 1; }
|
|
command -v npm >/dev/null 2>&1 || { echo "npm (Node.js) est requis." >&2; exit 1; }
|
|
|
|
echo "==> Frontend (Svelte)"
|
|
cd "$ROOT/frontend"
|
|
if [[ ! -d node_modules ]]; then
|
|
echo " installation des dépendances..."
|
|
npm install
|
|
fi
|
|
npm run build
|
|
|
|
echo "==> Backend (Rust)"
|
|
cd "$ROOT/backend"
|
|
if [[ "$PROFILE" == "release" ]]; then
|
|
cargo build --release
|
|
else
|
|
cargo build
|
|
fi
|
|
|
|
echo
|
|
echo "Build terminé."
|
|
if [[ "$PROFILE" == "release" ]]; then
|
|
echo " binaire : $ROOT/backend/target/release/filehost"
|
|
else
|
|
echo " binaire : $ROOT/backend/target/debug/filehost"
|
|
fi
|
|
echo " frontend : $ROOT/frontend/dist"
|