How salesforce/design-system-react works
Project Type and Purpose
• This is an open-source, presentational React component library (“Design System React”) wrapping the Salesforce Lightning Design System (SLDS).
High-Level File-Structure Analysis
• Top-level “components” folder: one subfolder per component (e.g. button, modal, accordion), each containing source (JSX/TS), prop‐type validators, docs, examples, tests.
• “utilities”: shared helper functions, design tokens, samples.
• “scripts”: build/test/publish pipelines (dist.sh, circle-ci hooks, storybook builder, babel transforms).
• “.circleci” & “.github”: CI definitions driving automated tests, code quality checks, and NPM publish.
• Build config files: Babel, Webpack, Jest, Storybook.
Key Components
A. Source Code
• Components (React/JSX, CSS class usage)
• Utilities & design tokens
B. Developer Workflow
• Local Dev: Storybook server for live examples
• Tests: Jest unit, Axe accessibility, Storybook snapshot tests
• Build scripts: Babel compile, Webpack bundles
• CI/CD: CircleCI + GitHub Actions
C. Deployment & Consumption
• NPM Registry (package @salesforce/design-system-react)
• Consumers: Any React application
Relationships and Data Flows
• Source → Build Scripts → Transpiled Modules & Bundles.
• CI Triggers: commits/PRs → run tests & build → on success → publish to NPM.
• Consumers Import:
• import {Button} from '@salesforce/design-system-react' → loads compiled JS module
• <link> tags or webpack serve CSS → apply SLDS styles
Architectural Patterns and Principles
• Modular Component Pattern: Each React component in its own folder with docs, examples, tests.
• Tree-shaking–friendly ES modules (export individual components).
• Separation of Concerns: source vs. tests vs. docs vs. assets.
• CI-driven quality gates before publishing.
Essential Details to Capture
• Components folder structure and role in packaging
• Utilities & design-token pipelines
• CI/CD flow and triggers
• Runtime integration points (React import, CSS link, IconSettings)