Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs
Refactor gen-og-images script to leverage satori over puppeteer
### WHY are these changes introduced? - Fixes Shopify/polaris-internal#1278 Our existing `gen-og-images` script creates an og-image layout using HTML markup and then runs puppeteer to take snapshots of each generated layout. This is relatively slow, this PR aims to swap this logic out for [Satori](https://github.com/vercel/satori) vercel's library for doing the exact same markup to og-image procedure but without having to spin up a puppeteer instance. ### WHAT is this pull request doing? * Convert our HTML markup to JSX * Convert `<style>` tag CSS to inline css for each of our JSX elements. (This is a limitation of satori, in that it does not support global <style> tags * Remove puppeteer logic in favor of a single call to satori ```tsx satori(someMarkup, someConfig) ``` * Leverage [@inter-ui](https://www.npmjs.com/package/inter-ui) to download non-variable versions of Inter for use in our generated layout. (A limitation of the underlying library that Satori leverages for type support (opentype.js) is that it does not support variable fonts) * Leverage [@napi-rs/image](https://www.npmjs.com/package/@napi-rs/image) to convert our generated svg from satori into a png file for use as an og-image. --------- Co-authored-by: Jess Telford <jess.telford@shopify.com>
- Loading branch information