Repository navigation
Bake tutorial card images instead of rendering them with sharp - #854
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Tutorial cards were composed on every request by
/docs/api/tutorialimgwithsharp. That's native code, which blocks moving docs to Cloudflare Workers, and it rebuilt the same ~50 images over and over.What changed
scripts/tutorial-cards.tsbakes one card per tutorial's first technology intopublic/img/tutorials/cards/<tech>.jpg. It uses the same layout as the old route and the same Directus fallback when a logo is missing. Cards are 960px wide JPGs (the old route served 1920px); 53 cards total 476 KB.TutorialCard.vuepoints at the static file.server/api/tutorialimg.ts.sharpmoves to devDependencies (only the script uses it).pnpm tutorial-cards:checkruns in Docs Checks. It fails if a tutorial uses a technology that has no card, and tells you to runpnpm tutorial-cards.Adding a tutorial with a new technology
public/img/tutorials/<tech>.png. Without it, the card uses the Directus logo.pnpm tutorial-cardsand commit the new card.Notes
These technologies have no logo, so they fall back to Directus, same as before:
supabase,framer,airbyte,clay,render.Three logos were misnamed, so their tutorials always showed the Directus logo. They're renamed here and now get their own cards:
springboot.pngtospring-boot.png,11ty.pngtoeleventy.png,inggest.pngtoinngest.png.Screenshot
/docs/tutorialswith the baked cards:Verified
nuxtcard against the live route output: same layout./docs/tutorialsrenders the static cards, and every card URL returns 200.pnpm typecheck:scripts, ESLint on the changed files, andpnpm tutorial-cards:checkpass.