Files
hyprcrd/dist.sh
T
thandClaude Opus 4.6 b9bd294c90 fix: image resize preview, todo checkbox alignment, modal overflow clip
- Image resize respects width attr in preview (no more snap-back)
- Single-task checkbox aligned with flex center instead of translateY hack
- Modal/detail containers clip card-bar at rounded corners
- Right-click on image no longer triggers resize (left-button only)
- Split dist.sh and bump.sh into separate scripts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:17:24 +02:00

75 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# Build hyprcrd distribution ZIP (no version bump — use ./bump.sh first)
set -e
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Usage: ./dist.sh"
echo ""
echo "Builds Tailwind CSS, minifies JS/CSS, and creates"
echo "hyprcrd-{version}.zip ready for deployment."
echo ""
echo "To bump the version first: ./bump.sh [--patch|--minor|--major]"
exit 0
fi
cd "$(dirname "$0")"
VERSION=$(grep "APP_VERSION" config.php | grep -oP "'[^']+'" | tail -1 | tr -d "'")
echo "Building v${VERSION}"
DIST="hyprcrd-${VERSION}.zip"
STAGE="/tmp/hyprcrd-stage-$$"
rm -rf "$STAGE"
# Rebuild Tailwind if CLI exists
if [ -x ./tailwindcss ]; then
echo "Building Tailwind CSS..."
./tailwindcss --input public/css/tailwind.css --output public/css/tailwind.out.css --content "public/index.php,public/js/**/*.js" --minify
fi
# Copy source to staging
echo "Staging files..."
mkdir -p "$STAGE"
cp -r config.php Dockerfile docker-entrypoint.sh README.md dist.sh .gitignore src public "$STAGE/"
mkdir -p "$STAGE/data"
touch "$STAGE/data/.gitkeep"
rm -rf "$STAGE/public/uploads" "$STAGE/data"
mkdir -p "$STAGE/public/uploads"
touch "$STAGE/public/uploads/.gitkeep"
rm -f "$STAGE/public/css/tailwind.css"
# Minify JS
if command -v npx &>/dev/null; then
echo "Minifying JS..."
for f in "$STAGE"/public/js/app.js "$STAGE"/public/js/modules/*.js; do
[ -f "$f" ] || continue
npx --yes terser "$f" --compress --mangle --module -o "$f" 2>/dev/null && \
echo " $(basename "$f")" || echo " SKIP $(basename "$f")"
done
echo "Minifying CSS..."
for f in "$STAGE"/public/css/style.css "$STAGE"/public/css/fonts.css; do
[ -f "$f" ] || continue
npx --yes csso-cli "$f" -o "$f" 2>/dev/null && \
echo " $(basename "$f")" || echo " SKIP $(basename "$f")"
done
else
echo "npx not found, skipping minification"
fi
# Create ZIP
echo "Creating ${DIST}..."
cd "$STAGE"
zip -r "$OLDPWD/$DIST" . -x "*.gitkeep" 2>/dev/null
# Re-add gitkeep for uploads only
zip "$OLDPWD/$DIST" public/uploads/.gitkeep
cd "$OLDPWD"
# Cleanup
rm -rf "$STAGE"
# Size comparison
ORIG=$(du -sb public/js/ public/css/style.css | awk '{s+=$1}END{print s}')
FINAL=$(stat -c%s "$DIST")
echo "Done: ${DIST} ($(du -h "$DIST" | cut -f1))"