#!/bin/bash
# Generate WordPress.org plugin assets from SVG files
# Requires: librsvg (install with: brew install librsvg)

set -e

echo "Generating WordPress.org plugin assets..."

# Check if rsvg-convert is installed
if ! command -v rsvg-convert &> /dev/null; then
    echo "Error: rsvg-convert not found!"
    echo "Install with: brew install librsvg"
    exit 1
fi

# Navigate to .wordpress-org directory
cd "$(dirname "$0")"

# Generate icons from SVG
echo "Generating icons..."
rsvg-convert -w 128 -h 128 icon.svg -o icon-128x128.png
rsvg-convert -w 256 -h 256 icon.svg -o icon-256x256.png

# Generate banners from SVG
echo "Generating banners..."
rsvg-convert -w 772 -h 250 banner-772x250.svg -o banner-772x250.png
rsvg-convert -w 1544 -h 500 banner-772x250.svg -o banner-1544x500.png

echo "✓ Assets generated successfully!"
echo ""
echo "Generated files:"
ls -lh *.png
