Add Liquid docs bundle command#1240
Conversation
FKauwe
left a comment
There was a problem hiding this comment.
I tophatted and the commands compile, build, run on my machine and the unit tests test both happy and sad path. This seems like a helpful addition to have "fresh" docs available in between extension releases
|
|
||
| Usage: | ||
| download <dir> \t\tDownloads all docsets and JSON Schemas to the specified directory. | ||
| bundle \t\t\tPrints a self-contained Liquid docs JSON bundle. |
There was a problem hiding this comment.
this is the first time I've seen the \t\t\t and asked Claude about it. Apparently it's a way to align the descriptions into columns. C mentioned that there are some libraries that exist that that handle alignment automatically. Just curious what the tradeoffs are between this syntax and a library-- maybe a whole library is just overkill and the current syntax is more lightweight for the purposes you need?
There was a problem hiding this comment.
\t is a tab. While we could use a library, I think it's overkill for this CLI since this is mostly for internal use. It's not worth the trouble nor the dependency risk.
What are you adding in this PR?
Related issue: Shopify/developer-tools-team#783
Adds a stable Liquid docs bundle generator to
@shopify/theme-check-docs-updater.New package API:
New CLI command:
The command writes a self-contained JSON bundle to stdout:
{ "schemaVersion": 1, "revision": "40f966fc7793462726d9f8573c8d522f8ab44c54", "tags": [], "filters": [], "objects": [], "systemTranslations": {}, "schemas": [] }Logs from docs loading go to stderr so stdout can be redirected directly into a JSON artifact.
Why: browser-based hosts need a way to publish Liquid docs updates independently from theme-tools and extension releases. This PR only adds the generator; it does not change browser extension runtime behavior.
What's next? Any followup issues?
Follow-up PR: #1016 teaches the browser extension to fetch a published docs bundle at runtime and fall back to bundled docs if unavailable.
A separate host/CDN publisher can use this command after this package version is released, for example:
Tophatting
pnpm --dir packages/theme-check-docs-updater type-checkCI=1 pnpm vitest run packages/theme-check-docs-updater/src/themeLiquidDocsBundle.spec.ts packages/theme-check-docs-updater/src/themeLiquidDocsManager.spec.tspnpm --dir packages/theme-check-docs-updater buildpnpm --silent --dir packages/theme-check-docs-updater theme-docs bundle | jq '.revision, .schemaVersion'pnpm format:checkgit diff --checkBefore you deploy
changeset