Files
DumiFlex 926eb2cb07 feat: i18n locales (en) + per-node help pages (#2)
Wires two ComfyUI extension points so the nodes are discoverable to
casual users without reading source.

* i18n — `locales/en/` follows ComfyUI's auto-scan layout:
  - `nodeDefs.json` — display names, descriptions, input/output names,
    tooltips for WP_Context, WP_PromptAssembler, WP_Debug.
  - `settings.json` — Reduce motion + Contrast accessibility combos
    keyed as `wildcardPipeline_a11y_*`.
  - `main.json` — settings category labels (Wildcard Pipeline,
    Accessibility).
  English baseline only; structure ready for community PRs to add
  zh/ja/fr/etc. without code changes.
  Docs: https://docs.comfy.org/custom-nodes/i18n

* Help pages — `docs/help/<NodeId>.md` (markdown) gets copied to
  `js/docs/` (the WEB_DIRECTORY) at build time via
  `scripts/copy-help-docs.mjs`. ComfyUI auto-scans
  `${WEB_DIRECTORY}/docs/<NodeId>.md` and surfaces the rendered
  markdown in the node-help panel. Three pages written in casual-user
  voice: what the node does, how to use it, what icons mean — no dev
  jargon (no "last-write-wins", "idempotent", regex, etc.).
  Docs: https://docs.comfy.org/custom-nodes/help_page

* Build pipeline: `pnpm build:extension` now chains
  `vite build && pnpm docs:copy` so a fresh `js/` always carries the
  latest help pages alongside the bundled JS chunks. CI picks this up
  automatically (the same script ran by .github/workflows/ci.yml).
2026-04-26 05:51:57 +03:00

44 lines
1.4 KiB
JavaScript

#!/usr/bin/env node
// Copy markdown help pages from docs/help/ to js/docs/ so ComfyUI's
// node-help-page system can serve them under /extensions/<package>/docs/.
// ComfyUI auto-scans `${WEB_DIRECTORY}/docs/<NodeId>.md` (plus optional
// `<NodeId>/<locale>.md` overrides) — see
// https://docs.comfy.org/custom-nodes/help_page
//
// Run as part of `pnpm build:extension` so a fresh `js/` always has the
// latest docs alongside the bundled JS chunks.
import { readdirSync, statSync, mkdirSync, copyFileSync, rmSync } from "node:fs";
import { join, relative } from "node:path";
import { fileURLToPath } from "node:url";
const ROOT = fileURLToPath(new URL("..", import.meta.url));
const SRC = join(ROOT, "docs", "help");
const DST = join(ROOT, "js", "docs");
function walk(dir) {
const out = [];
for (const name of readdirSync(dir)) {
const full = join(dir, name);
if (statSync(full).isDirectory()) out.push(...walk(full));
else out.push(full);
}
return out;
}
try {
rmSync(DST, { recursive: true, force: true });
const files = walk(SRC);
for (const file of files) {
const rel = relative(SRC, file);
const target = join(DST, rel);
mkdirSync(join(target, ".."), { recursive: true });
copyFileSync(file, target);
console.log(` docs/help/${rel} → js/docs/${rel}`);
}
console.log(`Copied ${files.length} help file(s).`);
} catch (err) {
console.error("[copy-help-docs] failed:", err);
process.exit(1);
}