3.2 KiB
3.2 KiB
Migration Plan: Comfy-Org/ComfyUI-React-Extension-Template
Repo is being updated to match the Comfy-Org/ComfyUI-React-Extension-Template pattern,
adding a React/TypeScript Style Mixer UI alongside the existing custom nodes.
Steps
✅ Step 0 — Save this plan (first order of business)
Step 1 — Clean up the Python layer ← currently here
- Save plan to
PLAN.md - Delete broken tests (
tests/test_immac_tools.py— asserts old-style class attributes that don't exist onio.ComfyNode) - Remove dead dict registration from
src/immac_tools/__init__.py(NODE_CLASS_MAPPINGS,NODE_DISPLAY_NAME_MAPPINGS,WEB_DIRECTORY) - Remove unused
ExampleForwardingExtensionfromsrc/immac_tools/forwarding_nodes.py
Step 2 — Rewrite root __init__.py to match the template pattern
- Remove
WEB_DIRECTORYre-export - Set
NODE_CLASS_MAPPINGS = {}(nodes registered viacomfy_entrypoint) - Wire
comfy_entrypointtosrc/immac_tools/nodes.py - Register aiohttp static routes to serve
dist/immac_style_mixer/at/immac_style_mixer/ - Register
nodes.EXTENSION_WEB_DIRS[project_name]usingcomfy_config(with fallback)
Step 3 — Add Style Mixer REST API (src/immac_tools/api.py)
- Load/save
style_mixer_data.jsonin workspace root - Schema:
{ "styles": [{ "id", "name", "value", "favorite" }], "mixes": [{ "id", "name", "styles": [{ "style_id", "weight", "enabled" }], "favorite" }], "current_mix_id": null } - Routes (registered from
__init__.py):GET /immac_style_mixer/api/data→ return full data blobPOST /immac_style_mixer/api/data→ replace full data blob
Step 4 — Update pyproject.toml
- Change
includes = []→includes = ["dist/"] - Remove
[build-system]/[tool.setuptools]blocks (not needed; ComfyUI loads directly)
Step 5 — Scaffold ui/ (React + TypeScript + Vite)
ui/package.json— deps:react,react-dom,vite,@vitejs/plugin-react,typescript,@comfyorg/comfyui-frontend-types; build output →../dist/immac_style_mixerui/vite.config.ts— output../dist/immac_style_mixerui/tsconfig.json+ui/tsconfig.node.jsonui/src/main.tsx— registers ComfyUI extension; mounts panel as a sidebar tab viaapp.extensionManager.registerSidebarTab
Step 6 — Build UI components
hooks/useStyleMixerData.ts— fetch/save via/immac_style_mixer/api/datacomponents/StyleCard.tsx— name (editable), value, favorite star, deletecomponents/MixCard.tsx— name, radio to activate, list of style entries (name + weight slider + ON/OFF toggle + remove), favorite starcomponents/StyleGallery.tsx— grid of all styles; "Add Style" inline formcomponents/StyleMixerPanel.tsx— top-level: Current Mix / Mixes / Styles sections
Step 7 — GitHub Actions CI
.github/workflows/react-build.yml— on push tomain:npm ci+npm run buildinsideui/
Key Decisions
- Single
POST /immac_style_mixer/api/dataendpoint for all persistence (minimal backend; expand later) - Sidebar tab (not floating window) for the panel
dist/tracked in git — required for registry publishing viaincludes = ["dist/"]- Styles are user-defined strings (prompt text snippets)