This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Lerna monorepo with two packages: @czi-sds/components and @czi-sds/data-viz. Use these commands from the project root:
yarn start- Start Storybook development server on port 6006yarn build- Build all packages using Lernayarn test- Run Jest tests across all packagesyarn test:updateSnapshots- Update Jest snapshots across all packagesyarn lint- Run ESLint and Stylelint across all packagesyarn build-storybook- Build Storybook for productionyarn test-storybook- Run Storybook testsyarn storybook:axe- Build Storybook and run accessibility testsyarn storybook:axeOnly- Run accessibility tests without building storybookyarn namespace-check- Validate TypeScript namespace exports across all packages
yarn <script> --scope=@czi-sds/components- Run script only in components packageyarn <script> --scope=@czi-sds/data-viz- Run script only in data-viz package
- Individual tests: Use
yarn testwith Jest's standard options like--testNamePattern - Type checking:
yarn namespace-checkruns TypeScript namespace validation
- Root: Contains shared configuration (Lerna, ESLint, Stylelint, Jest, Storybook)
- packages/components: Main Science Design System (SDS) component library built on Material UI v5
- packages/data-viz: Data visualization components (primarily ECharts-based)
Built on Material UI v5 - Components are style wrappers that pass props through to MUI components.
Design System Foundation:
src/common/styles-dictionary/- Design tokens (colors, spacing, typography, etc.) built with Style Dictionarysrc/core/styles/- Theme configuration and utilities- Design tokens are compiled to CSS variables, SCSS variables, and Tailwind config
Component Structure:
- Each component follows consistent structure:
__storybook__/,__tests__/, main component file,style.ts - Components in
src/core/organized alphabetically - Storybook stories in
__storybook__/index.stories.tsx - Tests include snapshots and namespace validation
Key Exports:
- Components - React components with SDS styling
- Mixins - Grouped styles (e.g.,
fontHeaderXL) - Selectors - Theme helper functions (e.g.,
getColors,getSpaces) - CSS/SCSS Variables - For non-Emotion environments
- Tailwind Config - For Tailwind CSS integration
- ECharts-based visualization components
- Smaller package focused on scientific data visualization
- Shares same build pipeline and testing approach as components package
- Rollup for bundling (ESM and CJS outputs)
- TypeScript with strict configuration
- Style Dictionary for design token compilation
- SWC for fast compilation in Storybook
- Jest with Testing Library for unit tests
- Storybook for component development and visual testing
- Chromatic for visual regression testing
- Axe for accessibility testing
- Snapshot testing for component output validation
- Component Development: Create in appropriate
src/core/directory following existing patterns - Storybook: Stories are required for all components
- Testing: Unit tests and snapshots required
- Design Tokens: Stored in
src/common/styles-dictionary/design-tokens/ - Icons: SVG icons in
src/common/svgs/with corresponding entries insrc/core/Icon/map.ts
This repository follows a structured branching and release workflow to ensure code quality and safe deployments.
Create Feature Branch: For every change, create a new branch from main
git checkout main
git pull origin main
git checkout -b <feature-branch-name>Branch Naming Conventions:
- Features:
feat/<description>orSCIDS-<ticket-number>-<description> - Bug fixes:
fix/<description> - Documentation:
docs/<description>
Create Pull Request: After pushing your branch to remote
git push origin <feature-branch-name>Then create a PR via GitHub targeting the main branch.
Review Requirements:
- ✅ At least 1 review from the engineering team
- ✅ At least 1 review from the design team
- ✅ All CI checks must pass (tests, linting, build)
- ✅ No merge conflicts with
main
Once all review requirements are met:
- Squash and merge the PR into
main - Delete the feature branch after merge
The package publishing process is automated through GitHub Actions when changes are pushed to the prod branch.
Sync prod with main: First, ensure your local branches are up to date
git checkout main
git pull origin main
git checkout prod
git pull origin prodPull latest changes from main into prod:
git checkout prod
git pull origin mainResolve any conflicts if they arise (though they should be rare with this workflow).
Push to prod to trigger the release workflow:
git push origin prodThis push event triggers the automated release workflow which will:
- Run the full test suite
- Build all packages
- Determine version bumps based on conventional commits
- Update package versions and generate CHANGELOGs
- Publish packages to NPM
- Create git tags for the releases
After successful publishing, the workflow automatically:
- Creates a PR from
prodtomainwith version updates - This PR includes:
- Updated
package.jsonfiles with new versions - Updated
CHANGELOG.mdfiles - Git tags for the release
- Updated
Merge the automated PR:
- Review the version bump PR
- Ensure all version changes look correct
- Merge the PR to sync
mainwith the latest versions fromprod
This ensures both branches stay in sync and prevents future conflicts.
# Start new feature
git checkout main && git pull origin main
git checkout -b feat/my-feature
# After PR approval and merge to main
git checkout prod && git pull origin prod
git pull origin main
git push origin prod
# After automated release PR is created
# Review and merge the PR in GitHub UI- Never push directly to
mainorprod- Always use PRs - Version bumps are automatic - Based on conventional commit messages
- The release workflow handles:
- Version determination
- CHANGELOG generation
- NPM publishing
- PR creation for version sync
- Manual version overrides: Contact the release team if specific version control is needed
- Components are peer-dependency based to prevent version conflicts
- Material UI v5 compatibility is required
- All components should be accessible and follow SDS design principles
- The project uses Yarn workspaces with Lerna for package management
- Conventional commits are used for automated versioning and changelogs