feat(F-052): completed feature
This commit is contained in:
@@ -203,6 +203,29 @@ build_prod() {
|
||||
(cd "$PROJECT_DIR/frontend" && NEXT_PUBLIC_API_URL="$API_PUBLIC_URL" npm run build)
|
||||
echo '[INFO] Building SEO storefront...'
|
||||
(cd "$PROJECT_DIR/storefront" && API_BASE_URL="$API_PUBLIC_URL" NEXT_PUBLIC_API_URL="$API_PUBLIC_URL" npm run build)
|
||||
sync_uploads
|
||||
}
|
||||
|
||||
sync_uploads() {
|
||||
# Mirror admin's public/uploads to frontend and storefront so that product
|
||||
# images are reachable from any of the three apps.
|
||||
local src="$PROJECT_DIR/apps/admin/public/uploads"
|
||||
local peer1="$PROJECT_DIR/frontend/public/uploads"
|
||||
local peer2="$PROJECT_DIR/storefront/public/uploads"
|
||||
if [[ ! -d "$src" ]]; then
|
||||
return 0
|
||||
fi
|
||||
for peer in "$peer1" "$peer2"; do
|
||||
mkdir -p "$peer"
|
||||
# copy every file present in source but missing in peer
|
||||
while IFS= read -r -d '' f; do
|
||||
local name
|
||||
name="$(basename "$f")"
|
||||
if [[ ! -f "$peer/$name" ]]; then
|
||||
cp "$f" "$peer/$name" 2>/dev/null || true
|
||||
fi
|
||||
done < <(find "$src" -maxdepth 1 -type f -print0 2>/dev/null)
|
||||
done
|
||||
}
|
||||
|
||||
spawn_service() {
|
||||
@@ -262,6 +285,7 @@ start_all() {
|
||||
install_dependencies
|
||||
migrate
|
||||
[[ "$MODE" == "prod" ]] && build_prod
|
||||
sync_uploads
|
||||
for service in "${SERVICES[@]}"; do spawn_service "$service"; done
|
||||
echo
|
||||
print_urls
|
||||
|
||||
Reference in New Issue
Block a user