Add a docs watcher for the dev server - #5495
Open
dimitrieh wants to merge 2 commits into
Open
Conversation
Contributor
Author
|
@knolleary for your consideration when you're back |
✅ Deploy Preview for flowforge-website ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.

Description
nuxt/modules/docs-source.tscallssyncDocs()once, inside Nuxt'ssetup(), so a docsedit never re-syncs and the dev server has to be restarted to see it. This adds
scripts/watch_docs.mjs, which watches the resolved docs and re-runsnpm run docsonchange, and wires it into
devasdev:docs.startalready picks it up via--parallel dev:*.Two deliberate choices:
resolveSource()fromnuxt/lib/docs-sync.mjsrather than hardcoding a path,so it honours the same
FLOWFUSE_DOCS_LOCAL/ sibling / clone precedence the build usesand cannot drift from it. When the docs resolve to a clone there is nothing local to
edit, so it logs and exits 0, the same way
watch_blueprints.jsdoes when the blueprintcheckout is missing.
runOnChangeOnly, because the Nuxt module has already synced by the time this starts.Verified in a container against a fixture with a sibling checkout: an edit to an existing
page and a newly added page both landed in
nuxt/content/docswithin a second, with norestart, and the clone case exits immediately instead of watching nothing.
Worth a reviewer's eye:
writeDocs()innuxt/lib/docs-sync.mjsrmSyncs the wholecontent/docstree before recopying, so every save deletes and recreates every page. Thatis fine for the sync itself, but I have not checked how @nuxt/content's dev watcher reacts
to the whole collection disappearing and coming back, and on the real docs tree it may be
slow or visibly churn. If it does, the fix is to split a single-file path out of
copyDocsDir, which I have kept out of this PR since it touches code the CI docs checkdepends on.
Related Issue(s)
Closes #5432
Checklist