Spaces:
Paused
Paused
File size: 5,565 Bytes
d9a5afc cca484c d9a5afc 68812e3 d9a5afc | 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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | # Scripts
Utility scripts for developing, testing, releasing, and seeding OpenPosterDB.
## dev-worktree.sh
Prepares a freshly created git worktree for local development and runs it. A new
worktree is missing all the gitignored bits the app needs (`api/.env`, `api/db`,
`api/cache`, `web/node_modules`); this gets one runnable in a single command.
```bash
./scripts/dev-worktree.sh # set up (if needed) then run API + web
./scripts/dev-worktree.sh --fresh # also wipe api/db + api/cache first
./scripts/dev-worktree.sh --release # build/run the API in release mode
./scripts/dev-worktree.sh --setup-only # copy env + install deps, don't run
```
Run it from inside the worktree you want to set up (any subdirectory is fine).
### What it does
1. Copies `api/.env` from the **main** worktree if the current worktree lacks one (never overwrites an existing one).
2. With `--fresh`, deletes the current worktree's `api/db` and `api/cache` for a clean slate before running. In the **main** worktree this would wipe your primary data, so it asks for confirmation first (or pass `--yes`); in a linked worktree it wipes without asking.
3. Installs web dependencies (`npm ci`, falling back to `npm install`) if `web/node_modules` is missing.
4. Runs the Rust API (`cargo run` in `api/`, on `http://localhost:3000`) and the Vite dev server (`npm run dev` in `web/`, usually `http://localhost:5173`) together. Press Ctrl+C — or let either process exit — to stop both.
> The dev UI is served by Vite over plain HTTP at `http://localhost:5173`. If login
> appears broken, add `COOKIE_SECURE=false` to `api/.env` (see the main README) —
> otherwise the browser drops the auth cookie.
---
## seed.sh
Warms the OpenPosterDB cache by requesting posters for titles from the IMDB dataset. Entries are processed newest-first, using `endYear` for series (if available) and `startYear` otherwise.
Requires `title.basics.tsv` in the scripts directory. Download it from <https://datasets.imdbws.com/title.basics.tsv.gz> and extract.
```bash
./scripts/seed.sh <BASE_URL> [OPTIONS]
```
### Options
| Flag | Description | Default |
|------|-------------|---------|
| `-n, --limit NUM` | Total entries to seed (0 = unlimited) | `100` |
| `-N, --limit-per-type NUM` | Cap each type independently (e.g. 100k movies + 100k series) | none |
| `-t, --type TYPE` | `movie`, `tv`, or `both` | `both` |
| `-g, --genres GENRES` | Comma-separated genres to include (e.g. `"Action,Horror"`) | all |
| `-f, --year-from YEAR` | Minimum year (inclusive) | none |
| `-y, --year-to YEAR` | Maximum year (inclusive) | none |
| `-k, --key KEY` | API key to use | `t0-free-rpdb` |
| `-a, --assets ASSETS` | `poster`, `logo`, `backdrop`, or `all` | `poster` |
| `-d, --dry-run` | Print matching titles without making requests | off |
### Examples
```bash
# Seed the 100 newest titles (default)
./scripts/seed.sh http://localhost:3000
# Seed 500 movies from 2000 onwards
./scripts/seed.sh http://localhost:3000 -n 500 -t movie -f 2000
# Seed all horror and thriller titles, including logos and backdrops
./scripts/seed.sh http://localhost:3000 -n 0 -g "Horror,Thriller" -a all
# Preview what TV series from 2015-2023 would be seeded
./scripts/seed.sh http://localhost:3000 -t tv -f 2015 -y 2023 -d
# Seed 100k movies + 100k series in one run
./scripts/seed.sh http://localhost:3000 -N 100000
```
### Data files
| File | Description |
|------|-------------|
| `title.basics.tsv` | Extracted IMDB dataset used by the seed script. Not committed to git. |
| `imdb_ids.txt` | Plain list of all IMDB IDs (one per line, sorted). |
---
## test.sh
Runs the full test suite: backend (Rust), frontend unit tests (Vitest), and end-to-end tests (Playwright).
```bash
./scripts/test.sh
```
### What it does
1. Runs `cargo test` in `api/`
2. Runs `npx vitest run` in `web/`
3. Builds a container image with the `test-support` feature flag
4. Starts the container on port `3333`, loading API keys from `api/.env`
5. Waits for the backend to become healthy (up to 60s)
6. Runs Playwright E2E tests (`setup`, `settings`, `chromium`, `live` projects)
7. Tears down the container on exit
Requires either `podman` or `docker`.
---
## release.sh
Creates a new tagged release and pushes it to GitHub.
```bash
./scripts/release.sh <VERSION>
./scripts/release.sh repair
```
### Create a release
```bash
./scripts/release.sh 1.0.0
```
1. Checks that the working tree is clean
2. Updates the version in `api/Cargo.toml` and `web/package.json`
3. Updates `Cargo.lock` and `package-lock.json`
4. Commits, pushes to `main`, and creates a GitHub release with auto-generated notes
The `v` prefix is added automatically — pass `1.0.0`, not `v1.0.0`.
### Repair a release
```bash
./scripts/release.sh repair
```
Re-triggers the release workflow for the most recent tag by deleting and recreating the GitHub release. Useful when CI failed on the initial release.
---
## regenerate-examples.sh
Fetches example poster, logo, and backdrop images for a set of classic films and saves them to `web/public/examples/`. These are used in the web UI.
```bash
./scripts/regenerate-examples.sh [BASE_URL]
```
Defaults to `http://localhost:3000`. Uses the free API key. Fetches assets for:
- Nosferatu (`tt0013442`)
- Metropolis (`tt0017136`)
- The Cabinet of Dr. Caligari (`tt0010323`)
- The Phantom of the Opera (`tt0016220`)
- A Trip to the Moon (`tt0000417`)
- Safety Last! (`tt0014429`)
- The General (`tt0017925`)
Logos and backdrops that aren't available are silently skipped.
|