Repository navigation
Show a picture of each prototype on its gallery card - #15
Draft
bcsfreitas wants to merge 5 commits into
Draft
bcsfreitas wants to merge 5 commits into
bcsfreitas wants to merge 5 commits into
Conversation
yarn studio thumbnails [<folder>...] [--missing] [--stale] [--yes] [--json]
captures a prototype's first view, alone in its system's preview document,
in headless Chromium (1280x800 at scale 0.5, JPEG q80) into .thumbnail.jpg
and .thumbnail.json. It previews first, writes with --yes, works only in
prototypes the contributor may change, keeps the old picture when the view
errors or is empty, and reuses the running dev server's preview documents
or starts its own.
The manifest gives each prototype with a picture thumbnail { url, stale },
where stale compares a fingerprint of its files and system. The dev server
serves pictures from the prototype's folder; the build copies them to
_thumbnails/<id>.jpg and build:inspect checks every one it names.
CollectionCard gains an image prop: prototype cards show the picture in a
16:10 area, or a placeholder with the prototype icon, fading in without
layout shift and without animation under reduced motion. List view, Home
and system cards are unchanged.
The dev server's preview-document servers move to
tooling/preview/dev-documents.ts so the command can run them too.
Duplicating already copied .thumbnail.jpg and .thumbnail.json (dot files aren't skipped) and rewrote the record's artifactId with the other IDs. Now a plain duplicate's record gets the copy's fingerprint when the original's picture was current, since new IDs don't change what it shows, and a rebuild copy's record gets an empty fingerprint so it reads stale until it is rebuilt. Renames, moves, archiving and restoring carry the files inside the folder unchanged. systemVersion accepts anything with a dir, so the organizer can look up the system's version without loading the registry.
The manifest watcher's changed files now also feed tooling/thumbnails/auto.ts. A change inside a prototype marks it; about 4 s after its last change, its first view is captured when its picture is missing or stale and the running contributor may change it (own prototypes, or any as an Admin; never archived ones or ones whose system was deleted). Captures run one at a time in one shared headless Chromium, launched on first need and closed after 3 idle minutes or when the dev server closes. Hidden files never mark a prototype, so writing .thumbnail.* causes no capture loop; its manifest refresh carries the new address to open galleries. A view that errors keeps its last picture. A lock in the system's temporary folder lets only one dev server of a checkout capture at a time. Without Playwright's Chromium the dev server logs one line and stops trying.
STUDIO_THUMBNAILS=off skips automatic capture for one dev server. The e2e harness sets it so a background Chromium never competes with a scenario for the machine.
✅ Deploy Preview for ea-prototyping-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Each prototype card in the gallery now shows a picture of the prototype's first view, instead of only an icon.
What changes
yarn studio thumbnails [<folder>…] [--missing] [--stale] [--yes] [--json]previews, then takes pictures._thumbnails/<id>.jpgand never needs a browser. A missing picture never fails the build, andbuild:inspectchecks every picture the manifest names.Storage:
.thumbnail.jpg(JPEG q80, 640×400, roughly 20–80 KB) plus.thumbnail.json(artifactId,fingerprint,capturedAt) at each prototype's top level.Decisions
STUDIO_THUMBNAILS=offturns automatic capture off. The e2e harness sets it so a background Chromium never competes with a scenario.Checks
Last full run of
yarn lint,typecheck,format:checkandtest(1020 passed),buildandbuild:inspect: all green on the merged tree (69f69fa minus the last commit). The last commit (69f69fa) only turns automatic pictures off for the e2e harness, and after ittypecheckpassed. The e2e filesprototype-gallery,organize-prototypes,live-updatesanddeployed-sitethen passed 46 of 46.