feat(demo): vendor resized Pokémon artwork under public/ (BON-24) - #50
Merged
hunterbecton merged 2 commits intoAug 28, 2026
Merged
Conversation
|
Important Review skippedToo 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (196)
You can disable this status message by setting the Comment |
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
force-pushed
the
hunter/bon-24-demo-vendor-resized-pokemon-artwork
branch
from
August 28, 2026 12:50
ebd0660 to
91c1af3
Compare
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why?
Closes BON-24. Stacked on #49 (BON-23); the base branch is
hunter/bon-23-…and this PR retargets tomainonce #49 merges.After #49 the data was local but the images were not:
sprite,artwork, and evolutionspriteUrlstill pointed atraw.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 withimages.unoptimizedthe 120 px cards and 96 px evolution chain downloaded the full 475 px PNG.The snapshot script now vendors the artwork.
scripts/snapshot-pokeapi.mtsdownloads 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 withsharp(new demo devDependency; Next already pulled it into the store), and writesapps/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.jsonis now deterministic. It's keyed by name, so it used to take whichever order the fetches finished in; the script now emits it inALL_TYPESorder.next/imageoptimization is back on.images.unoptimizedwas only there to stop the server fetching from GitHub. With files underpublic/, 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 underpublic/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./_next/image?url=%2Fartwork%2F…and return 200; no request leaves the machine.