Skip to content

watch-help.js: image mirror non-recursive + one-shot at startup #49

@dnndev

Description

@dnndev

Problem

scripts/watch-help.js's deployImages() function had two shortcomings that left help images missing on the dev test site:

  1. Non-recursive. The function iterated top-level files only with if (fs.statSync(src).isFile()), silently skipping any subdirectory. All v5 screenshots live in img/v5/, so every image referenced from a v5 doc page 404'd on xmp5dev.
  2. One-shot at startup. Even when the watch is running, image changes during a session are not re-mirrored. Adding a new screenshot requires stopping and restarting the watcher.

Production packaging (Build-XmpV5.ps1 line 494) uses Copy-Item -Recurse so installed packages are unaffected — this is purely a local dev-deployment bug.

Status

  • Recursion fix — landed in the same change that swapped the in-app help renderer to markdown-it. deployImages() now walks subdirectories with an inner mirrorDir() helper.
  • Watch-for-changes — still TODO. Either chokidar-watch the img/ tree alongside the markdown files, or accept one-shot and document a manual remirror command (e.g. npm run help:images).

Repro (pre-fix)

  1. Add a screenshot to XModPro.Help/img/v5/
  2. Run npm run help:watch
  3. Observe: file is not copied to C:/TestSites/xmp5dev/DesktopModules/XModPro/help/img/v5/
  4. Image 404s in the in-app help viewer

Suggested next step

Add a chokidar watcher for the img/ subtree that re-runs mirrorDir() (or a single-file copy) on add/change/unlink events. Debounce by file path the same way the markdown rebuild does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions