How npmirajkar/stenicljs-reactjs-lerna works
Project Type and Purpose
• This is a monorepo-based design system for UI components.
• It consists of three tightly-coupled packages managed with Lerna and npm workspaces:
• A framework-agnostic StencilJS component library (atoms → molecules → organisms)
• React wrapper components that proxy the StencilJS web components
• A sample React application that consumes those wrappers
High-Level Architecture Components
a. Root Monorepo (Lerna + npm workspaces)
b. Package #1: StencilJS Component Library
• Source: /packages/components/src/components/{atoms,molecules,organisms}
• Build outputs:
• Web Components (custom elements)
• React proxy definitions (via stencil's reactOutputTarget)
c. Package #2: React Components (wrappers)
• Source: /packages/react-components/src/components
• Input: generated stencil-proxy definitions
• Output: NPM package of ready-to-use React components
d. Package #3: React App (demo/consumer)
• Source: /packages/react-app/src
• Imports React wrappers from package #2
• Bundles with Vite, applies TailwindCSS
Architectural Patterns & Design Principles
• Proxy Generation Pattern (Stencil → React proxy generation).
• Monorepo Management (Lerna + npm workspaces) for dependency hoisting and inter-package linking.
• Dev/Build Pipelines:
• StencilJS build pipeline (TS → PostCSS/Tailwind → Web Components + proxies)
• React Components build (TS compilation)
• React App build (Vite, CSS processing)