How beforeyoubid/ui-lib works
Project type and purpose
• This is a React "ui-lib" component library intended to be a shared repository of reusable UI components (buttons, inputs, date pickers, etc.) for BYB front-end projects.
• It includes source code under src/components, TypeScript types, unit tests (src/__tests__ and module_test), Storybook stories (src/stories), a build pipeline (rollup.config.ts), and CI/CD configuration (.circleci, GitHub Workflows, Danger).
File structure
• Top-level directories:
• src/ – core TSX components, hooks, constants, utilities
• src/components/ – each component in its own folder + index exports
• src/__tests__/ – Jest tests for each component
• src/stories/ – Storybook stories for visual QA
• module_test/ – sandbox test app demonstrating library usage
• Config/build/deploy:
• rollup.config.ts – build input/output definitions
• package.json – dependencies, build scripts, versioning
• tsconfig.json – TypeScript settings
• Jest configs – jest.config.js and module_test/jest.config.js
• CI: .circleci/, .github/workflows/, Dangerfile.ts (PR health checks)
README for additional insights
• Describes publishing guide: semantic versioning, yarn build to publish via Rollup.
• Notes that input in rollup.config determines the public API surface.
• Mentions usage of Rollup for bundling.
a. Main components:
• Source Code (TypeScript/React components)
• Tests (Jest)
• Storybook (Dev UI sandbox)
• Build Pipeline (Rollup)
• CI/CD Pipelines (CircleCI, GitHub Actions, Danger)
• NPM Registry (external service)
• Consumer Projects (BYB front-end apps that import ui-lib)
b. Relationships/interactions:
• Developers → modify src/components & tests & stories → push to GitHub
• GitHub push triggers CI (CircleCI + GitHub Actions + Danger)
• CI runs tests, Storybook build, security scans (CodeQL)
• Successful CI → tagged release → Rollup build → publish to npm registry
• Consumer Projects pull new versions from npm registry
• module_test serves as a local consumer for integration testing
c. Architectural patterns/design principles:
• Monorepo-style module grouping (folder per component)
• Single source of truth for types and styles (global.types, theme types)
• Separation of concerns: UI code vs. test code vs. stories vs. build config
• Semantic versioning for backwards-compatibility
d. Technologies/frameworks:
• React + TypeScript for component development
• Jest for unit tests
• Storybook for component demos
• Rollup for bundling into ESM/CJS outputs
• GitHub Actions & CircleCI for CI/CD
• Danger for PR quality checks
• Verdaccio (in module_test) for private registry simulation