-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsync-static.sh
More file actions
executable file
·38 lines (30 loc) · 905 Bytes
/
sync-static.sh
File metadata and controls
executable file
·38 lines (30 loc) · 905 Bytes
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
#!/usr/bin/env bash
# Script: sync-static.sh
# Does: Copies compliance/static files from backend/api/static (source of truth) to frontend/public.
# Run this whenever the backend static files change to keep the frontend web build in sync.
# Use: ./sync-static.sh
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SRC="$ROOT/backend/api/static"
DST="$ROOT/frontend/public"
FILES=(
apple-app-site-association
privacy-policy.html
account-deletion.html
)
for file in "${FILES[@]}"; do
src_path="$SRC/$file"
dst_path="$DST/$file"
if [[ ! -f "$src_path" ]]; then
echo "WARNING: Source file not found, skipping: $src_path"
continue
fi
if cmp -s "$src_path" "$dst_path" 2>/dev/null; then
echo "Up to date: $file"
else
cp "$src_path" "$dst_path"
echo "Synced: $file"
fi
done
echo "Sync complete."