didi-lot3-frontend/extension/build.sh
Top Clossers cec967f953 Livrare Lot 3 (Frontend): aplicație web, aplicație mobilă Android, extensie browser
- Surse complete web (React/Vite) + mobil (React Native/Expo) + extensie (MV3)
- Documentație de livrare: ghid utilizare, matrice trasabilitate cerințe, raport testare furnizor
- Artefacte binare: imagine Docker didi-frontend:lot3-1.0, APK, extensie v3.2.6 + SHA256SUMS
- Configurare adresă platformă externalizată (build args / .env / config.js)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 12:40:40 +03:00

52 lines
1.8 KiB
Bash
Executable file

#!/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"