#!/usr/bin/env bash set -euo pipefail # Keep single source assets below 20 MiB by default. Override in CI when a # stricter product budget is available. limit_bytes="${ASSET_LIMIT_BYTES:-20971520}" status=0 while IFS= read -r -d '' file; do size=$(wc -c < "$file") if (( size > limit_bytes )); then printf '%s\t%s\n' "$size" "$file" status=1 fi done < <(git ls-files -z -- 'assets/**') if (( status != 0 )); then printf '发现超过 %s 字节的受版本控制资源;请压缩、外置或使用 Git LFS。\n' "$limit_bytes" >&2 fi exit "$status"