#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
npm install
npm run build
echo "Frontend build OK."
if command -v cargo >/dev/null 2>&1; then
  npm run tauri:build
  echo "Desktop bundle OK."
else
  echo "Rust not installed — skip tauri:build. Install rustup for full desktop build."
fi
