Skip to content

Add a docs watcher for the dev server - #5495

Open
dimitrieh wants to merge 2 commits into
mainfrom
docs-dev-watcher
Open

Add a docs watcher for the dev server#5495
dimitrieh wants to merge 2 commits into
mainfrom
docs-dev-watcher

Conversation

@dimitrieh

Copy link
Copy Markdown
Contributor

Description

nuxt/modules/docs-source.ts calls syncDocs() once, inside Nuxt's setup(), so a docs
edit 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-runs npm run docs on
change, and wires it into dev as dev:docs. start already picks it up via
--parallel dev:*.

Two deliberate choices:

  • it calls resolveSource() from nuxt/lib/docs-sync.mjs rather than hardcoding a path,
    so it honours the same FLOWFUSE_DOCS_LOCAL / sibling / clone precedence the build uses
    and 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.js does when the blueprint
    checkout 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/docs within a second, with no
restart, and the clone case exits immediately instead of watching nothing.

Worth a reviewer's eye: writeDocs() in nuxt/lib/docs-sync.mjs rmSyncs the whole
content/docs tree before recopying, so every save deletes and recreates every page. That
is 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 check
depends on.

Related Issue(s)

Closes #5432

Checklist

  • I have read the contribution guidelines
  • I have considered the performance impact of these changes
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
  • For blog PRs, an Art Request has been created (instructions)

@dimitrieh
dimitrieh requested a review from knolleary August 4, 2026 17:11
@dimitrieh

Copy link
Copy Markdown
Contributor Author

@knolleary for your consideration when you're back

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for flowforge-website ready!

Name Link
🔨 Latest commit b1e8f9b
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/6a721c40f7f3e90008d81a79
😎 Deploy Preview https://deploy-preview-5495--flowforge-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 65 (🔴 down 3 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

README out of date with build instructions

1 participant