39 lines
1.1 KiB
Bash
39 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
# Convert + biome-fix + gate a list of packages in batches.
|
|
#
|
|
# Usage: bash scripts/batch-convert.sh <pkg-path-1>:<pkg-name-1> [<pkg-path-2>:<pkg-name-2> ...]
|
|
|
|
set -uo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "${ROOT}"
|
|
|
|
PKGS=("$@")
|
|
if [ "${#PKGS[@]}" -eq 0 ]; then
|
|
echo "usage: $0 <pkg-path>:<pkg-name> ..." >&2
|
|
exit 2
|
|
fi
|
|
|
|
# Phase 1: convert + biome for every package.
|
|
for entry in "${PKGS[@]}"; do
|
|
PATH_PART="${entry%%:*}"
|
|
NAME_PART="${entry##*:}"
|
|
echo "=== convert ${NAME_PART} ==="
|
|
bash "${ROOT}/scripts/convert-package-barrels.sh" "${PATH_PART}" 2>&1 | grep -E "Done:|WARNING|no violations" | head -3 || true
|
|
cd "${ROOT}/${PATH_PART}"
|
|
for i in 1 2 3; do
|
|
bunx biome check --write --max-diagnostics 1000 src/ 2>&1 | tail -1
|
|
done
|
|
cd "${ROOT}"
|
|
done
|
|
|
|
# Phase 2: build the turbo filter list.
|
|
FILTERS=()
|
|
for entry in "${PKGS[@]}"; do
|
|
NAME_PART="${entry##*:}"
|
|
FILTERS+=("--filter=${NAME_PART}")
|
|
done
|
|
|
|
echo "=== gate (${#PKGS[@]} packages) ==="
|
|
bunx turbo lint typecheck test "${FILTERS[@]}" 2>&1 | tail -10
|