seamapi / docs

Welcome to the Seam Docs.
https://docs.seam.co
4 stars 10 forks source link

Run code samples though formatter #291

Closed razor-x closed 2 weeks ago

razor-x commented 1 month ago

How can we do this? GitHub actions as part of the codegen? Let's make a plan before a PR.

razor-x commented 2 weeks ago

I couldn't find any obvious solution that would format all code blocks across all the markdown files. Instead we can add an option to createBlueprint to accept a function to format the code samples

razor-x commented 2 weeks ago

Added formatCode option to blueprint here: https://github.com/seamapi/blueprint/pull/69

Next step is to implement formatCode in this repo using https://www.npmjs.com/package/execa. Each syntax will callout to a format command (or for JS, just prettier). If the command is missing, skip formatting. This way, CI can install all the formatters, but they are optional for local development.