#!/bin/bash

LIMIT=25M

echo "Checking files larger than 25 MB..."
echo

FILES=$(find . -type f -size +$LIMIT -print)

if [ -z "$FILES" ]; then
    echo "✅ OK: No file larger than 25 MB found."
    echo "You can safely run: wrangler deploy"
else
    echo "⚠️ WARNING: The following files are larger than 25 MB:"
    echo
    find . -type f -size +$LIMIT -printf '%s %p\n' |
        sort -nr |
        numfmt --field=1 --to=iec
    echo
    echo "❌ Please remove/move these files before wrangler deploy."
fi
