#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"

echo "=== Harmony Desktop — Linux Build ==="

# Install dependencies
if [ ! -d "node_modules" ]; then
  echo "[1/3] Installing dependencies..."
  npm install
else
  echo "[1/3] Updating dependencies..."
  npm install
fi

echo "[2/3] Building Linux binary..."
npx electron-builder --linux

echo "[3/3] Done!"
echo "Output is in ./dist/"
ls -lh dist/*.AppImage dist/*.deb 2>/dev/null || true
