Curatenie referinte pre-livrare: - inlocuit IP intern 10.11.10.18 cu hostname didi.integrare.local (extensie, docker-compose, .env.example) - inlocuit domeniu vechi didi365.eu cu didi.integrare.local (scripturi build/audit) - redenumit identificatorul aplicatiei Android eu.didi365.mobile -> didi.mobile Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
52 lines
1.8 KiB
Bash
52 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
# Build a distributable .zip of the DIDI browser extension.
|
|
# Output: ../web/public/downloads/didi-extension-v<VERSION>.zip
|
|
# ../web/public/downloads/didi-extension-latest.zip (copy)
|
|
#
|
|
# Usage: ./build.sh
|
|
#
|
|
# Excluded from the zip: docs (*.md), build artifacts (*.zip), icon generators,
|
|
# the legacy extractors/ folder (dead code — extraction logic lives in content.js).
|
|
|
|
set -euo pipefail
|
|
|
|
SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
OUT_DIR="$(cd "$SRC_DIR/../web/public/downloads" && pwd)"
|
|
|
|
VERSION=$(grep '"version"' "$SRC_DIR/manifest.json" | head -1 | sed -E 's/.*"version"[[:space:]]*:[[:space:]]*"([^"]+)".*/\1/')
|
|
if [ -z "$VERSION" ]; then
|
|
echo "ERROR: cannot read version from manifest.json" >&2
|
|
exit 1
|
|
fi
|
|
|
|
ZIP_NAME="didi-extension-v${VERSION}.zip"
|
|
LATEST_NAME="didi-extension-latest.zip"
|
|
|
|
echo "[ext-build] Version: $VERSION"
|
|
echo "[ext-build] Source: $SRC_DIR"
|
|
echo "[ext-build] Output: $OUT_DIR/$ZIP_NAME"
|
|
|
|
cd "$SRC_DIR"
|
|
rm -f "$OUT_DIR/$ZIP_NAME" "$OUT_DIR/$LATEST_NAME"
|
|
|
|
# Build the zip excluding docs, build artifacts, and dead code.
|
|
# Try native zip first, fall back to docker (alpine has zip).
|
|
if command -v zip >/dev/null 2>&1; then
|
|
zip -r "$OUT_DIR/$ZIP_NAME" . \
|
|
-x "*.md" \
|
|
-x "*.zip" \
|
|
-x "build.sh" \
|
|
-x "generate_icons.*" \
|
|
-x "extractors/*" \
|
|
-x ".git/*"
|
|
else
|
|
docker run --rm -v "$SRC_DIR":/src -v "$OUT_DIR":/out -w /src alpine:latest \
|
|
sh -c "apk add --no-cache zip >/dev/null && zip -r /out/$ZIP_NAME . \
|
|
-x '*.md' -x '*.zip' -x 'build.sh' -x 'generate_icons.*' -x 'extractors/*' -x '.git/*'"
|
|
fi
|
|
|
|
cp "$OUT_DIR/$ZIP_NAME" "$OUT_DIR/$LATEST_NAME"
|
|
|
|
echo "[ext-build] Done."
|
|
echo "[ext-build] $OUT_DIR/$ZIP_NAME ($(du -h "$OUT_DIR/$ZIP_NAME" | cut -f1))"
|
|
echo "[ext-build] $OUT_DIR/$LATEST_NAME"
|