kalender und fixes
This commit is contained in:
1 parent
940d9bbde4
commit
416ca9e854
14 files changed
+376
-71
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
# Build hyprcrd distribution ZIP with version bump
|
||||
# Build hyprcrd distribution ZIP with version bump + minification
|
||||
set -e
|
||||
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
@@ -9,8 +9,8 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
echo " --minor bump minor version 0.1.2 → 0.2.0"
|
||||
echo " --major bump major version 0.2.0 → 1.0.0"
|
||||
echo ""
|
||||
echo "Builds Tailwind CSS, bumps version in config.php,"
|
||||
echo "and creates hyprcrd-{version}.zip with all source files."
|
||||
echo "Builds Tailwind CSS, minifies JS/CSS, bumps version in config.php,"
|
||||
echo "and creates hyprcrd-{version}.zip ready for deployment."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -32,6 +32,8 @@ sed -i "s/APP_VERSION', '${CURRENT}'/APP_VERSION', '${VERSION}'/" config.php
|
||||
echo "Version: ${CURRENT} → ${VERSION}"
|
||||
|
||||
DIST="hyprcrd-${VERSION}.zip"
|
||||
STAGE="/tmp/hyprcrd-stage-$$"
|
||||
rm -rf "$STAGE"
|
||||
|
||||
# Rebuild Tailwind if CLI exists
|
||||
if [ -x ./tailwindcss ]; then
|
||||
@@ -39,29 +41,48 @@ if [ -x ./tailwindcss ]; then
|
||||
./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"
|
||||
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}..."
|
||||
|
||||
zip -r "$DIST" \
|
||||
config.php \
|
||||
Dockerfile \
|
||||
docker-entrypoint.sh \
|
||||
README.md \
|
||||
dist.sh \
|
||||
.gitignore \
|
||||
src/ \
|
||||
public/ \
|
||||
-x "public/uploads/*" \
|
||||
-x "public/uploads/.gitkeep" \
|
||||
-x "public/css/tailwind.css"
|
||||
|
||||
# Add empty dirs with gitkeep
|
||||
mkdir -p /tmp/hyprcrd-dist/data
|
||||
mkdir -p /tmp/hyprcrd-dist/public/uploads
|
||||
touch /tmp/hyprcrd-dist/data/.gitkeep
|
||||
touch /tmp/hyprcrd-dist/public/uploads/.gitkeep
|
||||
cd /tmp/hyprcrd-dist
|
||||
zip -r "$OLDPWD/$DIST" data/.gitkeep public/uploads/.gitkeep
|
||||
cd "$STAGE"
|
||||
zip -r "$OLDPWD/$DIST" . -x "*.gitkeep" 2>/dev/null
|
||||
# Re-add gitkeep files
|
||||
zip "$OLDPWD/$DIST" data/.gitkeep public/uploads/.gitkeep
|
||||
cd "$OLDPWD"
|
||||
rm -rf /tmp/hyprcrd-dist
|
||||
|
||||
# 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))"
|
||||
Reference in new issue
Block a user