diff --git a/.project/designs/app/.gitignore b/.project/designs/app/.gitignore new file mode 100644 index 00000000..58a87693 --- /dev/null +++ b/.project/designs/app/.gitignore @@ -0,0 +1,10 @@ +# Vite cache + build output (regenerable, not source). +node_modules/ +.vite/ +dist/ + +# Stray emitted JS — sources are .ts/.tsx; tsc must run with --noEmit. +# These files broke the dev server's import resolution once already +# (Vite picked .js over .tsx siblings). Keep them out of the tree. +src/**/*.js +src/**/*.js.map diff --git a/.project/designs/app/tsconfig.json b/.project/designs/app/tsconfig.json index e032bce2..6f455de7 100644 --- a/.project/designs/app/tsconfig.json +++ b/.project/designs/app/tsconfig.json @@ -11,6 +11,7 @@ "noUnusedParameters": true, "noFallthroughCasesInSwitch": true, "skipLibCheck": true, + "noEmit": true, "resolveJsonModule": true, "baseUrl": ".", "paths": { diff --git a/tools/audio-fetch-batch.sh b/tools/audio-fetch-batch.sh index bd35083a..07dd5a2c 100755 --- a/tools/audio-fetch-batch.sh +++ b/tools/audio-fetch-batch.sh @@ -56,26 +56,62 @@ while IFS=$'\t' read -r output_path source_url licence attribution edits; do mkdir -p "$(dirname "$full_path")" stem="$(basename "$output_path" .ogg)" - src_ext="${source_url##*.}" - case "$src_ext" in - wav|ogg|mp3|flac) ;; - *) src_ext="bin" ;; - esac - staged="$STAGING/${stem}.${src_ext}" - # Convert github.com blob URLs to raw URLs automatically (still allow - # raw URLs and other hosts unchanged). + # Source URL may be one of: + # 1. direct file URL ending in .wav/.ogg/.mp3/.flac + # 2. github.com blob URL (auto-converted to raw) + # 3. ZIP archive with an inner path: "#" fetch_url="$source_url" - case "$source_url" in + inner_path="" + if [[ "$source_url" == *"#"* ]]; then + fetch_url="${source_url%%#*}" + inner_path="${source_url#*#}" + fi + case "$fetch_url" in https://github.com/*/blob/*) - fetch_url="$(echo "$source_url" | sed -e 's|github.com|raw.githubusercontent.com|' -e 's|/blob/|/|')" + fetch_url="$(echo "$fetch_url" | sed -e 's|github.com|raw.githubusercontent.com|' -e 's|/blob/|/|')" ;; esac - if ! curl -sfL -o "$staged" "$fetch_url"; then - echo " ✗ download failed: $fetch_url" >&2 - fail=$((fail + 1)) - continue + if [ -n "$inner_path" ]; then + # ZIP path: cache the archive once per URL, extract a single + # member into staging. + zip_hash="$(printf '%s' "$fetch_url" | shasum | cut -c1-8)" + zip_cache="$STAGING/_zip_${zip_hash}.zip" + zip_extract_dir="$STAGING/_zip_${zip_hash}" + if [ ! -f "$zip_cache" ]; then + if ! curl -sfL -o "$zip_cache" "$fetch_url"; then + echo " ✗ ZIP download failed: $fetch_url" >&2 + fail=$((fail + 1)) + continue + fi + fi + if [ ! -d "$zip_extract_dir" ]; then + mkdir -p "$zip_extract_dir" + if ! unzip -q -o "$zip_cache" -d "$zip_extract_dir"; then + echo " ✗ ZIP extract failed: $zip_cache" >&2 + fail=$((fail + 1)) + continue + fi + fi + staged="$zip_extract_dir/$inner_path" + if [ ! -f "$staged" ]; then + echo " ✗ ZIP missing inner file: $inner_path" >&2 + fail=$((fail + 1)) + continue + fi + else + src_ext="${fetch_url##*.}" + case "$src_ext" in + wav|ogg|mp3|flac) ;; + *) src_ext="bin" ;; + esac + staged="$STAGING/${stem}.${src_ext}" + if ! curl -sfL -o "$staged" "$fetch_url"; then + echo " ✗ download failed: $fetch_url" >&2 + fail=$((fail + 1)) + continue + fi fi # loudnorm two-pass would be more accurate, but for SFX one-pass is fine