Browse Source

update checking script

Yuki Takei 1 month ago
parent
commit
0e3621f872
1 changed files with 15 additions and 2 deletions
  1. 15 2
      apps/app/bin/check-next-symlinks.sh

+ 15 - 2
apps/app/bin/check-next-symlinks.sh

@@ -1,17 +1,30 @@
 #!/bin/bash
 # Check that all .next/node_modules/ symlinks resolve correctly after assemble-prod.sh.
-# fslightbox-react is intentionally broken (useEffect-only import, never accessed during SSR).
 # Usage: bash apps/app/bin/check-next-symlinks.sh (from monorepo root)
 set -euo pipefail
 
 NEXT_MODULES="apps/app/.next/node_modules"
 
+# Packages that are intentionally broken symlinks.
+# These are only imported via useEffect + dynamic import() and never accessed during SSR.
+ALLOWED_BROKEN=(
+  fslightbox-react
+  @emoji-mart/data
+  @emoji-mart/react
+)
+
+# Build a grep -v pattern from the allowlist
+grep_args=()
+for pkg in "${ALLOWED_BROKEN[@]}"; do
+  grep_args+=(-e "$pkg")
+done
+
 broken=$(find "$NEXT_MODULES" -maxdepth 2 -type l | while read -r link; do
   linkdir=$(dirname "$link")
   target=$(readlink "$link")
   resolved=$(cd "$linkdir" 2>/dev/null && realpath -m "$target" 2>/dev/null || echo "UNRESOLVABLE")
   { [ "$resolved" = "UNRESOLVABLE" ] || [ ! -e "$resolved" ]; } && echo "BROKEN: $link"
-done | grep -v 'fslightbox-react' || true)
+done | grep -v "${grep_args[@]}" || true)
 
 if [ -n "$broken" ]; then
   echo "ERROR: Broken symlinks found in $NEXT_MODULES:"