|
1
|
#!/bin/bash |
|
2
|
# Verify all @/ imports in the artifact resolve to real files. |
|
3
|
# Usage: bash expo_verify_imports.sh <app-name> |
|
4
|
|
|
5
|
set -euo pipefail |
|
6
|
|
|
7
|
if [ $# -lt 1 ]; then |
|
8
|
echo "Usage: bash expo_verify_imports.sh <app-name>" |
|
9
|
exit 1 |
|
10
|
fi |
|
11
|
|
|
12
|
APP="$1" |
|
13
|
|
|
14
|
BROKEN_IMPORTS=$({ grep -rn "from ['\"]@/" "artifacts/$APP/" --include="*.ts" --include="*.tsx" 2>/dev/null || true; } | while IFS= read -r line; do |
|
15
|
file=$(echo "$line" | cut -d: -f1) |
|
16
|
import_path=$(echo "$line" | sed -n "s/.*from ['\"]@\/\([^'\"]*\)['\"].*/\1/p") |
|
17
|
base="artifacts/$APP/$import_path" |
|
18
|
if [ ! -f "$base.ts" ] && [ ! -f "$base.tsx" ] && [ ! -f "$base/index.ts" ] && [ ! -f "$base/index.tsx" ] && [ ! -f "$base" ]; then |
|
19
|
echo "BROKEN: $file → @/$import_path" |
|
20
|
fi |
|
21
|
done) |
|
22
|
|
|
23
|
if [ -n "$BROKEN_IMPORTS" ]; then |
|
24
|
echo "$BROKEN_IMPORTS" |
|
25
|
echo "Fix every broken import before proceeding." |
|
26
|
exit 1 |
|
27
|
else |
|
28
|
echo "All @/ imports resolve." |
|
29
|
fi |