Skip to content

Add a docs watcher for the dev server - #5495

Merged
knolleary merged 4 commits into
mainfrom
docs-dev-watcher
Aug 17, 2026
Merged

Add a docs watcher for the dev server#5495
knolleary merged 4 commits into
mainfrom
docs-dev-watcher

Conversation

@dimitrieh

@dimitrieh dimitrieh commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Editing a product doc currently means restarting the dev server, because docs-source.ts
syncs once inside Nuxt's setup() and never again. This watches the resolved docs and syncs
each change.

The first version of this ran the existing whole-tree sync on every save. That deletes and
recreates all 130-odd pages, and the dev server ran out of heap re-indexing them, on the
first edit. So the sync gained a single-file path and the watcher uses it: one edit, one
write. A full build still produces byte-identical output, which matters because the CI docs
check and the Netlify deploy both run through it.

chokidar rather than nodemon, because nodemon can only re-run a command and cannot say which
file changed.

Verified against a real flowfuse checkout: 30 consecutive edits with the dev server alive and
its memory flat, plus new page, delete, rename, README and image cases, and the clone case
exiting instead of watching nothing.

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 d88ba0c
🔍 Latest deploy log https://app.netlify.com/projects/flowforge-website/deploys/6a82fc860ed1ce0008c9a370
😎 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: 66 (🟢 up 10 from production)
Accessibility: 96 (no change from production)
Best Practices: 100 (no change from production)
SEO: 85 (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.

@knolleary

Copy link
Copy Markdown
Member

I tried this locally a few times without success - I get out of memory errors every time I change any docs.

[4] FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

@knolleary

Copy link
Copy Markdown
Member

The memory required by nuxt to rebuild the site when docs update is completely unworkable. It should not require GBs of memory to turn some markdown into html.

The only solution I can think of would be to make the script smarter - only copy files that have changed. That is its own resource intensive operation, but, to be frank, I'd rather wait a few seconds for the rebuild to happen, then have to restart the whole stack every time.

copyDocsDir walks a whole tree at once, which is all a build needs. A dev-server edit needs
the opposite: one file. Split the per-file copy out of the walk so both go through the same
code, and expose it as syncDocsPath, which also removes a page whose source has gone.

Checked against the real docs tree that a full sync still produces byte-identical output,
since the CI documentation check and the Netlify deploy both run through it.
nuxt/modules/docs-source.ts syncs once inside Nuxt's setup(), so a docs edit never re-syncs
and the dev server has to be restarted to see it. Watch the resolved docs instead and sync
each change on its own.

chokidar rather than nodemon: nodemon restarts a command, so the only thing it can run is
the whole sync, which deletes and recreates all 130-odd pages on every save. The dev server
runs out of heap re-indexing that. chokidar also polls when CHOKIDAR_USEPOLLING is set,
which is how every other watcher in this repo reaches host edits from the dev container.
@dimitrieh
dimitrieh requested review from a team and Yndira-E as code owners August 17, 2026 12:14
dimitrieh and others added 2 commits August 17, 2026 14:15
dev:nuxt is what both files point docs authors at, and it is the one dev command that does
not start dev:docs, so an edit there still needs a restart.
@dimitrieh

Copy link
Copy Markdown
Contributor Author

@knolleary I did another run on it, can you check it again?

@knolleary

Copy link
Copy Markdown
Member

Looks much better - thanks @dimitrieh

@knolleary
knolleary enabled auto-merge (squash) August 17, 2026 12:28
@knolleary
knolleary merged commit 7991930 into main Aug 17, 2026
7 checks passed
@knolleary
knolleary deleted the docs-dev-watcher branch August 17, 2026 13:15
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

2 participants