How salesforce-ux/design-system works
Main Components
• Design Tokens & Themes:
– Indicate that these tokens provide the foundation for styling, reused across components.
• UI Components:
– Represent the vast “ui” directory (and “ui/components”) that holds React components, SCSS files, and stories (also seen in components like buttons, alerts, modals, etc.).
– Also include the “shared” and “touch” directories for components that have specialized functionality.
• Utilities and Helpers:
– Highlight the “utilities” directory (for alignment, spacing, text, etc.) that offers helper classes and functions.
– Note additional helper modules found under “shared/utils” and “ui/shared”.
• Build, Linting, and Automation Tools:
– Represent the “scripts” and “gulpfile.js” nodes. These run tasks such as compiling Sass (found in “scripts/compile”), linting, generating documentation, and releasing builds.
– Include CI/CD configuration (GitHub workflows, Travis scripts, and Heroku deployment files such as Procfile).
• Documentation, Guidelines, and Testing:
– Show a component for “Guidelines & Documentation” (e.g., the “guidelines” folder, README files, annotations guides, and troubleshooting documents).
– Represent testing (unit tests in “__tests__”, accessibility testing with aXe – seen in the gulp tasks, and Storybook integration that provides a live development environment).
Interactions and Relationships
• Data Flow & Dependency:
– Link Build Tools (Gulp, scripts) to components and tokens, showing that they compile, lint, and bundle assets.
– Show how CI/CD pipelines (Travis, GitHub actions) monitor changes in the repository and trigger tasks (tests, linting, builds).
– Connect the Storybook environment (launched via npm start) to the UI Components and Documentation to represent component development and preview.
• Modular & Layered Architecture:
– Use distinct modules (or layers) separated by responsibility: Foundation layer (tokens/themes and base styles), UI/building blocks layer (React components), and the tooling layer (automation scripts, testing, and release pipelines).
Architectural Patterns & Design Principles
• Component-Driven Design:
– Emphasize that UI components are isolated, reusable building blocks (as evident from the many component folders and Storybook stories).
• Separation of Concerns:
– Clearly separate style tokens, component code, and build/test scripts.
• Automated Build and Test:
– Highlight the integration of automated linting, tests (including accessibility and unit tests), and continuous integration via scripts and CI configuration files.
Technologies & Ecosystem
• Mention key technologies such as:
– React (for building UI components)
– Sass/SCSS (for styling)
– Gulp (for build tasks)
– Storybook (for component development)
– Node.js (with npm and nvm configurations, as noted by the .nvmrc file)
– YAML (for design tokens)
– Testing libraries like Jest and Axe for accessibility tests.