Skip to content

feat(demo): vendor resized Pokémon artwork under public/ (BON-24) - #50

Merged
hunterbecton merged 2 commits into
mainfrom
hunter/bon-24-demo-vendor-resized-pokemon-artwork
Aug 28, 2026
Merged

hunterbecton merged 2 commits into
mainfrom
hunter/bon-24-demo-vendor-resized-pokemon-artwork

Conversation

@hunterbecton

@hunterbecton hunterbecton commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

What/Why?

Closes BON-24. Stacked on #49 (BON-23); the base branch is hunter/bon-23-… and this PR retargets to main once #49 merges.

After #49 the data was local but the images were not: sprite, artwork, and evolution spriteUrl still pointed at raw.githubusercontent.com, so a network blip still showed broken images in the browser. GitHub raw is not a CDN (cache-control: max-age=300), and with images.unoptimized the 120 px cards and 96 px evolution chain downloaded the full 475 px PNG.

The snapshot script now vendors the artwork. scripts/snapshot-pokeapi.mts downloads the official artwork for every Pokémon in range plus every species its evolution chains reach (pichu, the eeveelutions, and the rest, so no stage renders a broken image), resizes to 480 px WebP with sharp (new demo devDependency; Next already pulled it into the store), and writes apps/demo/public/artwork/{id}.webp. Raw PNGs average 145 KB, so Gen 1 would have been ~20 MB of uncompressible binaries; the WebPs are 3.9 MB for 188 files (151 Gen 1 plus 37 evolution-chain species outside it).

Local paths in the snapshot. The three URL fields are now /artwork/{id}.webp. No component changed.

types.json is now deterministic. It's keyed by name, so it used to take whichever order the fetches finished in; the script now emits it in ALL_TYPES order.

next/image optimization is back on. images.unoptimized was only there to stop the server fetching from GitHub. With files under public/, the optimizer resizes from disk, so the cards and chain get correctly sized images with no outbound request.

Copyright: the artwork is Nintendo/Game Freak's. This moves the copies from the PokeAPI sprites repo into this one, for a non-commercial demo.

Testing

  • lib/pokeapi.test.ts: sprite and artwork fields assert the local paths, pikachu's chain asserts /artwork/172.webp, /artwork/25.webp, /artwork/26.webp, and a new coverage test collects every artwork path in the snapshot and checks the file exists under public/artwork/. Red against the feat(demo): read a local PokeAPI snapshot instead of fetching per request (BON-23) #49 snapshot (four failures on the GitHub URLs), green after regeneration.
  • cd apps/demo && vp test --run: 91 passed.
  • cd apps/demo && vp check: format pass, lint 0 errors (one pre-existing warning), tsc clean.
  • cd apps/demo && vp run build: passes.
  • Dev server: the home page's card images resolve to /_next/image?url=%2Fartwork%2F… and return 200; no request leaves the machine.

@coderabbitai

coderabbitai Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 196 files, which is 96 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review is too large to run within your organization's remaining usage spending cap. Raise or remove your spending cap in the billing tab, then retry.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fcd1f68f-e918-43db-a5e8-29e15cbe8ede

📥 Commits

Reviewing files that changed from the base of the PR and between 567391f and 88e7383.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (196)
  • .gitattributes
  • apps/demo/data/evolution-chains.json
  • apps/demo/data/pokemon.json
  • apps/demo/data/types.json
  • apps/demo/lib/pokeapi.test.ts
  • apps/demo/next.config.ts
  • apps/demo/package.json
  • apps/demo/public/artwork/1.webp
  • apps/demo/public/artwork/10.webp
  • apps/demo/public/artwork/100.webp
  • apps/demo/public/artwork/101.webp
  • apps/demo/public/artwork/102.webp
  • apps/demo/public/artwork/103.webp
  • apps/demo/public/artwork/104.webp
  • apps/demo/public/artwork/105.webp
  • apps/demo/public/artwork/106.webp
  • apps/demo/public/artwork/107.webp
  • apps/demo/public/artwork/108.webp
  • apps/demo/public/artwork/109.webp
  • apps/demo/public/artwork/11.webp
  • apps/demo/public/artwork/110.webp
  • apps/demo/public/artwork/111.webp
  • apps/demo/public/artwork/112.webp
  • apps/demo/public/artwork/113.webp
  • apps/demo/public/artwork/114.webp
  • apps/demo/public/artwork/115.webp
  • apps/demo/public/artwork/116.webp
  • apps/demo/public/artwork/117.webp
  • apps/demo/public/artwork/118.webp
  • apps/demo/public/artwork/119.webp
  • apps/demo/public/artwork/12.webp
  • apps/demo/public/artwork/120.webp
  • apps/demo/public/artwork/121.webp
  • apps/demo/public/artwork/122.webp
  • apps/demo/public/artwork/123.webp
  • apps/demo/public/artwork/124.webp
  • apps/demo/public/artwork/125.webp
  • apps/demo/public/artwork/126.webp
  • apps/demo/public/artwork/127.webp
  • apps/demo/public/artwork/128.webp
  • apps/demo/public/artwork/129.webp
  • apps/demo/public/artwork/13.webp
  • apps/demo/public/artwork/130.webp
  • apps/demo/public/artwork/131.webp
  • apps/demo/public/artwork/132.webp
  • apps/demo/public/artwork/133.webp
  • apps/demo/public/artwork/134.webp
  • apps/demo/public/artwork/135.webp
  • apps/demo/public/artwork/136.webp
  • apps/demo/public/artwork/137.webp
  • apps/demo/public/artwork/138.webp
  • apps/demo/public/artwork/139.webp
  • apps/demo/public/artwork/14.webp
  • apps/demo/public/artwork/140.webp
  • apps/demo/public/artwork/141.webp
  • apps/demo/public/artwork/142.webp
  • apps/demo/public/artwork/143.webp
  • apps/demo/public/artwork/144.webp
  • apps/demo/public/artwork/145.webp
  • apps/demo/public/artwork/146.webp
  • apps/demo/public/artwork/147.webp
  • apps/demo/public/artwork/148.webp
  • apps/demo/public/artwork/149.webp
  • apps/demo/public/artwork/15.webp
  • apps/demo/public/artwork/150.webp
  • apps/demo/public/artwork/151.webp
  • apps/demo/public/artwork/16.webp
  • apps/demo/public/artwork/169.webp
  • apps/demo/public/artwork/17.webp
  • apps/demo/public/artwork/172.webp
  • apps/demo/public/artwork/173.webp
  • apps/demo/public/artwork/174.webp
  • apps/demo/public/artwork/18.webp
  • apps/demo/public/artwork/182.webp
  • apps/demo/public/artwork/186.webp
  • apps/demo/public/artwork/19.webp
  • apps/demo/public/artwork/196.webp
  • apps/demo/public/artwork/197.webp
  • apps/demo/public/artwork/199.webp
  • apps/demo/public/artwork/2.webp
  • apps/demo/public/artwork/20.webp
  • apps/demo/public/artwork/208.webp
  • apps/demo/public/artwork/21.webp
  • apps/demo/public/artwork/212.webp
  • apps/demo/public/artwork/22.webp
  • apps/demo/public/artwork/23.webp
  • apps/demo/public/artwork/230.webp
  • apps/demo/public/artwork/233.webp
  • apps/demo/public/artwork/236.webp
  • apps/demo/public/artwork/237.webp
  • apps/demo/public/artwork/238.webp
  • apps/demo/public/artwork/239.webp
  • apps/demo/public/artwork/24.webp
  • apps/demo/public/artwork/240.webp
  • apps/demo/public/artwork/242.webp
  • apps/demo/public/artwork/25.webp
  • apps/demo/public/artwork/26.webp
  • apps/demo/public/artwork/27.webp
  • apps/demo/public/artwork/28.webp
  • apps/demo/public/artwork/29.webp
  • apps/demo/public/artwork/3.webp
  • apps/demo/public/artwork/30.webp
  • apps/demo/public/artwork/31.webp
  • apps/demo/public/artwork/32.webp
  • apps/demo/public/artwork/33.webp
  • apps/demo/public/artwork/34.webp
  • apps/demo/public/artwork/35.webp
  • apps/demo/public/artwork/36.webp
  • apps/demo/public/artwork/37.webp
  • apps/demo/public/artwork/38.webp
  • apps/demo/public/artwork/39.webp
  • apps/demo/public/artwork/4.webp
  • apps/demo/public/artwork/40.webp
  • apps/demo/public/artwork/41.webp
  • apps/demo/public/artwork/42.webp
  • apps/demo/public/artwork/43.webp
  • apps/demo/public/artwork/439.webp
  • apps/demo/public/artwork/44.webp
  • apps/demo/public/artwork/440.webp
  • apps/demo/public/artwork/446.webp
  • apps/demo/public/artwork/45.webp
  • apps/demo/public/artwork/46.webp
  • apps/demo/public/artwork/462.webp
  • apps/demo/public/artwork/463.webp
  • apps/demo/public/artwork/464.webp
  • apps/demo/public/artwork/465.webp
  • apps/demo/public/artwork/466.webp
  • apps/demo/public/artwork/467.webp
  • apps/demo/public/artwork/47.webp
  • apps/demo/public/artwork/470.webp
  • apps/demo/public/artwork/471.webp
  • apps/demo/public/artwork/474.webp
  • apps/demo/public/artwork/48.webp
  • apps/demo/public/artwork/49.webp
  • apps/demo/public/artwork/5.webp
  • apps/demo/public/artwork/50.webp
  • apps/demo/public/artwork/51.webp
  • apps/demo/public/artwork/52.webp
  • apps/demo/public/artwork/53.webp
  • apps/demo/public/artwork/54.webp
  • apps/demo/public/artwork/55.webp
  • apps/demo/public/artwork/56.webp
  • apps/demo/public/artwork/57.webp
  • apps/demo/public/artwork/58.webp
  • apps/demo/public/artwork/59.webp
  • apps/demo/public/artwork/6.webp
  • apps/demo/public/artwork/60.webp
  • apps/demo/public/artwork/61.webp
  • apps/demo/public/artwork/62.webp
  • apps/demo/public/artwork/63.webp
  • apps/demo/public/artwork/64.webp
  • apps/demo/public/artwork/65.webp
  • apps/demo/public/artwork/66.webp
  • apps/demo/public/artwork/67.webp
  • apps/demo/public/artwork/68.webp
  • apps/demo/public/artwork/69.webp
  • apps/demo/public/artwork/7.webp
  • apps/demo/public/artwork/70.webp
  • apps/demo/public/artwork/700.webp
  • apps/demo/public/artwork/71.webp
  • apps/demo/public/artwork/72.webp
  • apps/demo/public/artwork/73.webp
  • apps/demo/public/artwork/74.webp
  • apps/demo/public/artwork/75.webp
  • apps/demo/public/artwork/76.webp
  • apps/demo/public/artwork/77.webp
  • apps/demo/public/artwork/78.webp
  • apps/demo/public/artwork/79.webp
  • apps/demo/public/artwork/8.webp
  • apps/demo/public/artwork/80.webp
  • apps/demo/public/artwork/81.webp
  • apps/demo/public/artwork/82.webp
  • apps/demo/public/artwork/83.webp
  • apps/demo/public/artwork/84.webp
  • apps/demo/public/artwork/85.webp
  • apps/demo/public/artwork/86.webp
  • apps/demo/public/artwork/863.webp
  • apps/demo/public/artwork/865.webp
  • apps/demo/public/artwork/866.webp
  • apps/demo/public/artwork/87.webp
  • apps/demo/public/artwork/88.webp
  • apps/demo/public/artwork/89.webp
  • apps/demo/public/artwork/9.webp
  • apps/demo/public/artwork/90.webp
  • apps/demo/public/artwork/900.webp
  • apps/demo/public/artwork/91.webp
  • apps/demo/public/artwork/92.webp
  • apps/demo/public/artwork/93.webp
  • apps/demo/public/artwork/94.webp
  • apps/demo/public/artwork/95.webp
  • apps/demo/public/artwork/96.webp
  • apps/demo/public/artwork/97.webp
  • apps/demo/public/artwork/979.webp
  • apps/demo/public/artwork/98.webp
  • apps/demo/public/artwork/99.webp
  • apps/demo/scripts/snapshot-pokeapi.mts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands.

After BON-23 the data was local but the images still came from
raw.githubusercontent.com, so a network blip still showed broken
images, and with `images.unoptimized` the 120 px cards and 96 px
evolution chain downloaded the full 475 px PNG.

The snapshot script now downloads the official artwork for every
Pokémon in range plus every species its evolution chains reach,
resizes it to 480 px WebP with `sharp` (new demo devDependency), and
writes `public/artwork/{id}.webp`: 188 files, 3.9 MB, against ~20 MB
of PNGs that git could not compress. The snapshot's `sprite`,
`artwork`, and `spriteUrl` fields are now `/artwork/{id}.webp`, so no
component changed, and `images.unoptimized` is gone so next/image
resizes from disk again.

Also emit `types.json` in `ALL_TYPES` order instead of fetch
completion order, so regenerating the snapshot no longer churns it.

Co-Authored-By: Claude Fable 5 <[email protected]>
@hunterbecton
hunterbecton force-pushed the hunter/bon-24-demo-vendor-resized-pokemon-artwork branch from ebd0660 to 91c1af3 Compare August 28, 2026 12:50
@hunterbecton
hunterbecton changed the base branch from hunter/bon-23-demo-snapshot-pokeapi-data-to-local-json-instead-of-fetching to main August 28, 2026 12:50
@hunterbecton
hunterbecton merged commit 2aa1224 into main Aug 28, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant