28 lines
1.3 KiB
Bash
Executable File
28 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Refresh of the plane pokedex (/trackers/planes) on stan-ovh.
|
|
#
|
|
# ssh stan@37.187.157.191 'cd ~/dev/website-planes && git fetch -q && git checkout -q --detach origin/main \
|
|
# && bun install --frozen-lockfile >/dev/null && scripts/planes-refresh.sh'
|
|
#
|
|
# 1. bun scripts/planes-import.ts --report-new rebuilds makers/types from Wikidata + English
|
|
# Wikipedia (infobox + specs) and notes which makers/types did not exist before. Dex numbers
|
|
# are stable (types are matched by Wikidata id).
|
|
# 2. bun scripts/planes-photos.ts --missing finds Wikimedia Commons photos for types that
|
|
# have none yet (new ones included) and maker logos that are missing.
|
|
# stdout: one JSON report {generatedAt, totals, newMakers, newTypes[] (with photo)}.
|
|
# Progress goes to stderr. DB_URL is read from the running app container and never printed.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
if [ -z "${DB_URL:-}" ]; then
|
|
DB_URL=$(sudo docker inspect personal-website-app-1 --format '{{range .Config.Env}}{{println .}}{{end}}' |
|
|
sed -n 's/^DB_URL=//p' | sed 's/@db:5432/@127.0.0.1:5440/')
|
|
export DB_URL
|
|
fi
|
|
|
|
report=$(mktemp /tmp/planes-report.XXXXXX.json)
|
|
trap 'rm -f "$report"' EXIT
|
|
|
|
bun scripts/planes-import.ts --report-new "$@" >"$report"
|
|
bun scripts/planes-photos.ts --missing --enrich "$report" --fetch
|