|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +Component library providing reusable UI components for Journeys. This is a published package that includes Storybook for component documentation and visual testing. |
| 6 | + |
| 7 | +## Project Structure |
| 8 | + |
| 9 | +- **Components**: `src/components/` - Components definition |
| 10 | +- **Stories**: `src/stories/` - Storybook stories for components |
| 11 | +- **Utils**: `src/utils/` - Shared utilities |
| 12 | + |
| 13 | +## Tech Stack |
| 14 | + |
| 15 | +- **Framework**: React 18+ with TypeScript as peer dependency |
| 16 | +- **Build and tests**: Vite, Vitest and Storybook with a11y addon for accessibility tests |
| 17 | +- **Styling**: SCSS modules with typescript definitions |
| 18 | +- **Component primitives**: Radix UI for accessible primitives |
| 19 | +- **Animation**: Motion (Framer Motion) for animations |
| 20 | +- **Form management**: React Hook Form support |
| 21 | + |
| 22 | +## Commands |
| 23 | + |
| 24 | +```bash |
| 25 | +pnpm install # Install dependencies |
| 26 | +pnpm check # Run lint, tests and storybook build to verify changes |
| 27 | +pnpm storybook # Run storybook (http://localhost:6006) |
| 28 | +pnpm build:package # Production build |
| 29 | +pnpm build:storybook # Builds storybook |
| 30 | +pnpm lint # Check formatting with ESLint and Prettier |
| 31 | +pnpm lint:fix # Automatically resolve lint errors |
| 32 | +pnpm test # Run unit tests |
| 33 | +pnpm changelog # Generate changelog |
| 34 | +pnpm release # Release new package version |
| 35 | +``` |
| 36 | + |
| 37 | +## Code Style Guidelines |
| 38 | + |
| 39 | +- Use TypeScript strict mode |
| 40 | +- Use modern and idiomatic syntax |
| 41 | +- Component interfaces need to be accessible and meet [WCAG standards](https://www.w3.org/WAI/standards-guidelines/wcag/) |
| 42 | +- Prefer Radix UI primitives as a base for new components |
| 43 | +- Use `import type { ... }` for type-only imports |
| 44 | +- Use specific imports to improve tree shaking |
| 45 | + |
| 46 | +### Development Workflow |
| 47 | + |
| 48 | +1. **Start Storybook**: `pnpm storybook` to develop components interactively |
| 49 | +2. **Write components**: In `src/components/ComponentName/` |
| 50 | +3. **Declare types**: Declare component types in co-colated `types.ts` file |
| 51 | +4. **Style**: Style components in co-colated SCSS modules, generate TypeScript definitions |
| 52 | +5. **Document**: Create stories in `src/stories/` or co-located |
| 53 | +6. **Test**: Write Vitest tests for component logic and accessibility requirements |
| 54 | +7. **Build**: Test package build with `pnpm build:package` |
| 55 | + |
| 56 | +## Publishing Workflow |
| 57 | + |
| 58 | +1. **Make changes**: Update components, add tests, update stories, commit |
| 59 | +2. **Verify changes**: `pnpm check` to verify changes |
| 60 | +3. **Publish**: Ask for confirmation, then `pnpm release` (publishes to npm) |
| 61 | + |
| 62 | +## Important Notes |
| 63 | + |
| 64 | +- **Published**: This package is published to npm (MIT license) |
| 65 | +- **Versioning**: Uses semantic versioning (patch version auto-bumped on publish) |
| 66 | +- **Changelog**: Are auto-generated from commits |
| 67 | +- **Storybook**: Primary development and documentation tool |
| 68 | + |
| 69 | +## Other |
| 70 | + |
| 71 | +- See root `AGENTS.md` for monorepo-wide context |
0 commit comments