#!/bin/bash # Sync LinkML schemas from source to frontend public directory # This ensures the frontend serves the latest schemas during development and in production builds set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" SOURCE_DIR="$PROJECT_ROOT/schemas/20251121/linkml" DEST_DIR="$PROJECT_ROOT/frontend/public/schemas/20251121/linkml" echo "Syncing LinkML schemas..." echo " Source: $SOURCE_DIR" echo " Dest: $DEST_DIR" # Ensure destination directory exists mkdir -p "$DEST_DIR" # Rsync with delete to remove old files rsync -av --delete \ --exclude "*.pyc" \ --exclude "__pycache__" \ --exclude ".git" \ "$SOURCE_DIR/" \ "$DEST_DIR/" echo "Schema sync complete!" # Count files synced TOTAL=$(find "$DEST_DIR" -type f -name "*.yaml" | wc -l | tr -d ' ') echo " Total YAML files: $TOTAL"