-
Notifications
You must be signed in to change notification settings - Fork 360
Add a tool for previewing shopify.dev reference docs #1404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
We detected some changes in |
packages/docs-preview/bin/cli.js
Outdated
|
|
||
| console.log('Watching: ' + docsMetaFile); | ||
|
|
||
| async function run() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this code, but it works. Initially I passed an env variable to the remix app with the path to the metafile. Then the remix app could just fs.readFile the metafile within a loader. The issue is it didn't pickup changes. It's kinda heavy to copy a whole file into the remix app, but it seemed simplest to just do that have have all of Remix's dev-server file watchers take care of everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hope you love it more now 😂 8433ccc
|
Great tool! Made some changes to fix hot refresh. Maybe the tool should live in |
| delete require.cache[process.env.DOCS_META_FILE!]; | ||
| const data = require(process.env.DOCS_META_FILE!); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! This is what I didn't know how to do!
ffce99e to
25fdf67
Compare
WHY are these changes introduced?
At the moment it's really difficult to build reference docs, because the docs generation system builds a large json file, which then needs to be copied to a spin instance to preview the final output.
WHAT is this pull request doing?
This creates a tool that allows you to preview the docs in a local remix app. It has HMR and stays up to date as you continually build the docs. It doesn't have 100% of the features of the final docs experience, but it should help us create docs more quickly without going directly to spin.
HOW to test your changes?
Run
npm run preview-docsfrom bothpackages/hydrogenandpackages/hydrogen-reactPost-merge steps
Checklist