scripts/import_publications.py imports all osw=1 publications from
03-data/osws.xml — upserts pub rows, loads cover images, scans
03-data/osdb/{pubId}/ for fruit images and PDFs, links matched fruits
by osdb_number. Idempotent re-runs. 17 unit tests. Makefile updated
to include import_publications_test in make test. Added
scripts/README_import.md with run order. Added spec-first rule to
.claude/CLAUDE.md.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
43 lines
1.2 KiB
Makefile
43 lines
1.2 KiB
Makefile
# -include: silently skip if .env doesn't exist (e.g. fresh clone before 'cp .env.example .env')
|
|
-include .env
|
|
export
|
|
|
|
.PHONY: dev-db migrate-up migrate-down run-backend run-frontend test fmt
|
|
|
|
## dev-db: start postgres and block until healthy
|
|
dev-db:
|
|
docker compose up -d db
|
|
@echo "Waiting for Postgres to be healthy..."
|
|
@until [ "$$(docker inspect --format='{{.State.Health.Status}}' osdb-db 2>/dev/null)" = "healthy" ]; do \
|
|
echo " still starting..."; \
|
|
sleep 2; \
|
|
done
|
|
@echo "Postgres is healthy."
|
|
|
|
## migrate-up: apply all pending migrations
|
|
migrate-up:
|
|
cd backend && go run ./cmd/server migrate
|
|
|
|
## migrate-down: roll back one migration step
|
|
migrate-down:
|
|
cd backend && go run ./cmd/server migrate down
|
|
|
|
## run-backend: start the Echo API server
|
|
run-backend:
|
|
cd backend && go run ./cmd/server
|
|
|
|
## run-frontend: start the Vite dev server
|
|
run-frontend:
|
|
cd frontend && npm run dev
|
|
|
|
## test: run all backend, frontend, and script tests
|
|
test:
|
|
cd backend && go test ./...
|
|
cd frontend && npm run test -- --run
|
|
cd scripts && python3 -m unittest import_fruits_test import_publications_test -v
|
|
|
|
## fmt: format all code
|
|
fmt:
|
|
cd backend && gofmt -w .
|
|
cd frontend && npx prettier --write .
|