Navigate privacy laws with feline precision — detect every boundary, respect every territory! GDPR compliance and privacy protection for WordPress. - Cookie consent management - Privacy boundary detection - GDPR-compliant analytics gating - Cross-plugin consent coordination (integrates with TigerStyle Heat) - Visitor preference tracking - Configurable cookie categories Includes build.sh and .distignore for WordPress-installable release ZIPs.
50 lines
1.4 KiB
Bash
Executable File
50 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Build a clean WordPress-installable release ZIP for this plugin.
|
|
# Reads .distignore to decide what gets excluded.
|
|
# Usage: ./build.sh [version-override]
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PLUGIN_SLUG="$(basename "$SCRIPT_DIR")"
|
|
MAIN_FILE="$SCRIPT_DIR/${PLUGIN_SLUG}.php"
|
|
OUT_DIR="$SCRIPT_DIR/build"
|
|
|
|
if [[ ! -f "$MAIN_FILE" ]]; then
|
|
echo "ERROR: main plugin file $MAIN_FILE not found" >&2
|
|
exit 1
|
|
fi
|
|
|
|
VERSION="${1:-$(grep -E "^\s*\*\s*Version:" "$MAIN_FILE" | head -1 | awk '{print $NF}')}"
|
|
if [[ -z "$VERSION" ]]; then
|
|
echo "ERROR: could not determine version" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ZIP_NAME="${PLUGIN_SLUG}-${VERSION}.zip"
|
|
OUT_ZIP="$OUT_DIR/$ZIP_NAME"
|
|
STAGE="$(mktemp -d -t "${PLUGIN_SLUG}-build-XXXXXX")"
|
|
trap "rm -rf '$STAGE'" EXIT
|
|
|
|
echo "Building $PLUGIN_SLUG v$VERSION → $OUT_ZIP"
|
|
|
|
EXCLUDE_ARGS=(--exclude='.git')
|
|
if [[ -f "$SCRIPT_DIR/.distignore" ]]; then
|
|
while IFS= read -r line; do
|
|
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
|
[[ -z "${line// }" ]] && continue
|
|
EXCLUDE_ARGS+=(--exclude="$line")
|
|
done < "$SCRIPT_DIR/.distignore"
|
|
fi
|
|
|
|
mkdir -p "$STAGE/$PLUGIN_SLUG"
|
|
rsync -a "${EXCLUDE_ARGS[@]}" "$SCRIPT_DIR/" "$STAGE/$PLUGIN_SLUG/"
|
|
|
|
mkdir -p "$OUT_DIR"
|
|
rm -f "$OUT_ZIP"
|
|
( cd "$STAGE" && zip -rq "$OUT_ZIP" "$PLUGIN_SLUG" )
|
|
|
|
SIZE=$(numfmt --to=iec --suffix=B "$(stat -c '%s' "$OUT_ZIP")")
|
|
COUNT=$(unzip -Z1 "$OUT_ZIP" | wc -l)
|
|
echo "✓ Built: $ZIP_NAME ($SIZE, $COUNT files)"
|