Skip to content

feat(pipeline): add InDesign React component generator#102

Merged
PAMulligan merged 1 commit into
mainfrom
66-indesign-pipeline-react-component-generator-tsx-output-tailwindcss-modules-storybook-stories
Jun 20, 2026
Merged

feat(pipeline): add InDesign React component generator#102
PAMulligan merged 1 commit into
mainfrom
66-indesign-pipeline-react-component-generator-tsx-output-tailwindcss-modules-storybook-stories

Conversation

@PAMulligan

Copy link
Copy Markdown
Collaborator

Summary

The final build stage of the InDesign-to-React pipeline (#66, part of #62): turn the IR (#63/#64) + design tokens (#65) into a directory of importable, typed React components — the stage that makes the design a finished React package.

New packages/pipeline/src/react/ subsystem plus a --emit-components CLI flow.

What it generates

Per spread, one .tsx component:

  • Frames → JSX — text frames become semantic tags (h1h6 / p / figcaption) inferred from the paragraph-style role; image frames become <img> (or next/image when --framework next); layout is a token-spaced flow, or a grid for multi-column spreads.
  • Typed props — an explicit …Props type for every extracted content field (heading?, body?, image?, imageAlt?, …), with the extracted text / image src as defaults, so consumers override content while keeping layout.
  • Two styling modes — Tailwind classes that resolve via the mapper's preset ([InDesign pipeline] Style and design-token mapper (paragraph/character styles + swatches → tokens + Tailwind preset) #65), or co-located .module.css referencing the tokens.css custom properties.
  • Storybook stories — one *.stories.tsx per component, populated with the extracted content as default args.
  • Barrel + reportindex.ts, and indesign-pipeline-report.md listing produced files, staged assets, unmapped IR nodes, and accessibility TODOs (e.g. images missing alt text).

Generated output is deterministic — the same IR produces byte-identical files.

CLI

aurelius-indesign brochure.idml --emit-components ./src/components --style tailwind --framework react

Acceptance criteria (#66)

  • Generator runs end-to-end on the fixture and produces components that tsc --noEmit accepts (verified via the TS compiler API) and that render without runtime errors (verified via react-dom/server)
  • Tailwind path compiles against React JSX + the preset's class names
  • CSS Modules path compiles with a co-located .module.css (verified with a *.module.css module shim)
  • At least one Storybook story per component, with extracted content as default args
  • Snapshot tests cover generated JSX for two fixture spreads (text-heavy and image-heavy)
  • Generation report enumerates produced files, unmapped IR nodes, and accessibility TODOs
  • Deterministic output (snapshot-verified)

Testing

  • pnpm --filter @aurelius/pipeline typecheck / test / build ✅ — 128 tests (11 new)
  • Repo-wide eslint . (0 errors) and prettier --check . ✅; check-doc-counts ✅; lockfile in sync
  • Verified the compiled CLI on a real PDF: PDF → IR → tokens → components, with image extraction and a generation report

Notes

  • --emit-components resolves tokens internally for class names; run --emit-tokens to also write the token files the components reference.
  • Dev deps added for compile/render verification: react, react-dom, @types/react, @types/react-dom (all pure JS).
  • Layout is a semantic, token-spaced flow (not pixel-perfect) — aligned with the epic's "usable IR + manual touch-ups" framing.

Closes #66
Part of #62

🤖 Generated with Claude Code

Turn the IR + design tokens into importable React artifacts — the final build
stage of the InDesign-to-React pipeline (#66, part of #62).

- One typed .tsx component per spread; names from page/spread with safe-id fallback
- Text frames -> semantic tags (h1-h6/p/figcaption) by paragraph-style role;
  image frames -> <img> or next/image; token-spaced flow/grid layout
- Explicit content prop types with extracted text/src as defaults
- Two styling modes: Tailwind classes via the mapper preset, or co-located
  CSS Modules referencing tokens.css custom properties
- Storybook stories per component with extracted content as default args
- index.ts barrel + indesign-pipeline-report.md (files, assets, unmapped nodes,
  a11y TODOs); deterministic output
- CLI: --emit-components <dir> with --style and --framework
- 11 new tests (128 total): generated TSX type-checks under strict tsc (Tailwind,
  CSS Modules, Next.js), renders via react-dom/server, plus JSX snapshots

Refs #66, #62

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan self-assigned this Jun 20, 2026
@PAMulligan PAMulligan added enhancement New feature or request pipeline Figma/Canva-to-React conversion pipeline labels Jun 20, 2026
@PAMulligan PAMulligan moved this from Todo to Done in PMDS Open Source Roadmap Jun 20, 2026
@PAMulligan PAMulligan added this to the v2.0.0 milestone Jun 20, 2026
@PAMulligan PAMulligan merged commit 55390c4 into main Jun 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pipeline Figma/Canva-to-React conversion pipeline

Projects

Development

Successfully merging this pull request may close these issues.

[InDesign pipeline] React component generator (TSX output, Tailwind/CSS Modules, Storybook stories)

1 participant