How emilkowalski/sonner works
Main Components
• Core Library:
• Core functionality located in the src folder (files like assets.tsx, hooks.tsx, index.tsx, state.ts, etc.). This is where the toast functionality is implemented.
• Components such as the Toaster component and other helper functions/types for managing the notifications.
• Testing Suite:
• Test folder as a separate component which manages both configuration (eslintrc, tsconfig, etc.) and actual test files (e.g. basic.spec.ts, testing app pages).
• That the tests simulate user interactions with the toast notifications (including Playwright tests from .github/workflows/playwright.yml).
• Example/Demo Application:
• The website folder contains a demo or documentation site (built with Next.js) showcasing the library usage.
• Components like individual pages, demo components (CodeBlock, Hero, Installation, etc.) demonstrating the functionalities.
• CI/CD and Build Infrastructure:
• .github directory that manages workflows, along with configuration files such as tsup.config.ts, turbo.json, and package.json. These illustrate the build, test, and deployment integration.
• Dependency and Tooling Configuration:
• Presence of configurations from package managers (pnpm-lock.yaml, pnpm-workspace.yaml) showing that the project is set up as a monorepo or multi-package project supporting multiple entry points.
Relationships and Data Flow
• That application developers import the “Sonner Library” into their projects (using npm install, as mentioned).
• From the “Sonner Library” to consumer React applications to show component integration.
• From “Demo Website” to the “Sonner Library” indicating demonstration and documentation usage.
• From “Test Suite” to “Sonner Library” to illustrate continuous verification.
• You show CI/CD pipelines triggering test executions and builds that deploy the demo/documentation site.
Architectural Patterns and Technologies
• Separation of concerns (the core library versus the demonstration, and testing are isolated).
• That the component-based structure leverages React’s component model.
• Use of Next.js within the website folder, and tooling such as Playwright for end-to-end tests.
• Mention dependency management from pnpm and build orchestration with turbo (turbo.json) and tsup.