-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-sync.sh
More file actions
executable file
·62 lines (56 loc) · 1.76 KB
/
check-sync.sh
File metadata and controls
executable file
·62 lines (56 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Check if root files are in sync with docs directory
# This ensures GitHub Pages deployment matches local development
echo "Checking sync between root and docs directory..."
errors=0
# Files that should be kept in sync
files_to_check=(
"workbench.html"
"index.html"
"styles.css"
)
for file in "${files_to_check[@]}"; do
if [ -f "$file" ] && [ -f "docs/$file" ]; then
if ! diff -q "$file" "docs/$file" > /dev/null 2>&1; then
echo "❌ ERROR: $file is out of sync with docs/$file"
echo " Run: cp $file docs/$file OR cp docs/$file $file (depending on which is correct)"
errors=$((errors + 1))
else
echo "✅ $file is in sync"
fi
elif [ ! -f "$file" ]; then
echo "⚠️ WARNING: $file exists in docs/ but not in root"
errors=$((errors + 1))
elif [ ! -f "docs/$file" ]; then
echo "⚠️ WARNING: $file exists in root but not in docs/"
errors=$((errors + 1))
fi
done
# Check directories that should be in sync
dirs_to_check=(
"workbench"
"chartspec"
"components"
"state"
"styles"
)
for dir in "${dirs_to_check[@]}"; do
if [ -d "$dir" ] && [ -d "docs/$dir" ]; then
if ! diff -qr "$dir" "docs/$dir" > /dev/null 2>&1; then
echo "❌ ERROR: $dir/ is out of sync with docs/$dir/"
echo " Run: rsync -av $dir/ docs/$dir/ OR rsync -av docs/$dir/ $dir/ (depending on which is correct)"
errors=$((errors + 1))
else
echo "✅ $dir/ is in sync"
fi
fi
done
if [ $errors -eq 0 ]; then
echo ""
echo "✅ All files are in sync!"
exit 0
else
echo ""
echo "❌ Found $errors sync issue(s). Please fix them before committing."
exit 1
fi