#!/usr/bin/env bash # docker-prep.sh — Pack @bytelyst/* packages as tarballs for Docker/CI builds. # Delegates to the universal prep-consumer.sh in learning_ai_common_plat. # # Usage: # ./scripts/docker-prep.sh # prep for docker build # ./scripts/docker-prep.sh --restore # undo package.json changes # # Prerequisites: # cd ../learning_ai_common_plat && pnpm build set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" COMMON_PLAT="${REPO_ROOT}/../learning_ai_common_plat" PREP_SCRIPT="${COMMON_PLAT}/scripts/prep-consumer.sh" if [ ! -f "$PREP_SCRIPT" ]; then echo "❌ Cannot find prep-consumer.sh at $PREP_SCRIPT" exit 1 fi # Consumers in this repo that use file: refs to @bytelyst/* packages CONSUMERS=(web) MODE="${1:-}" for consumer in "${CONSUMERS[@]}"; do TARGET="${REPO_ROOT}/${consumer}" if [ ! -d "$TARGET" ]; then echo "⚠️ Skipping ${consumer} — directory not found" continue fi if [[ "$MODE" == "--restore" ]]; then bash "$PREP_SCRIPT" "$TARGET" --restore else bash "$PREP_SCRIPT" "$TARGET" fi done if [[ "$MODE" != "--restore" ]]; then echo "" echo "✅ Docker prep complete. Restore with: ./scripts/docker-prep.sh --restore" fi