|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is a monorepo containing `@sect/solid-hiding-header`, a SolidJS component library that provides hiding header functionality on scroll. It's a port of the React version, wrapping the vanilla `hiding-header` library with SolidJS-specific components and context. |
| 8 | + |
| 9 | +## Development Commands |
| 10 | + |
| 11 | +**Monorepo Commands (run from root):** |
| 12 | +- `pnpm dev` - Start development for all packages |
| 13 | +- `pnpm build` - Build all packages |
| 14 | +- `pnpm test` - Run tests across all packages |
| 15 | +- `pnpm test:watch` - Run tests in watch mode |
| 16 | +- `pnpm test:e2e` - Run E2E tests (Playwright) for demo app |
| 17 | +- `pnpm lint` - Lint all packages |
| 18 | +- `pnpm lint:fix` - Fix linting issues |
| 19 | +- `pnpm type-check` - TypeScript type checking across all packages |
| 20 | +- `pnpm clean` - Clean all build artifacts and node_modules |
| 21 | + |
| 22 | +**Single Test Commands:** |
| 23 | +- In `packages/solid-hiding-header/`: `pnpm test` (Vitest) |
| 24 | +- In `apps/solidjs-boilerplate/`: `pnpm test:e2e` (Playwright) |
| 25 | + |
| 26 | +## Architecture |
| 27 | + |
| 28 | +### Monorepo Structure |
| 29 | +- `packages/solid-hiding-header/` - The main library package |
| 30 | +- `apps/solidjs-boilerplate/` - Demo application showcasing the library |
| 31 | +- Uses Turborepo for build orchestration and pnpm workspaces |
| 32 | + |
| 33 | +### Library Architecture (`packages/solid-hiding-header/`) |
| 34 | +- **Main Component**: `HidingHeader` - Wraps content and provides hiding functionality |
| 35 | +- **Context System**: Provides access to hiding header controls via React-like context pattern |
| 36 | +- **Hooks**: `useHidingHeader`, `useRunHidingHeader`, `usePauseHidingHeader`, etc. |
| 37 | +- **Core Dependency**: Built on top of `hiding-header` vanilla JavaScript library |
| 38 | +- **Build**: Uses Rollup with `rollup-preset-solid` for multiple output formats (ESM, CJS, types) |
| 39 | + |
| 40 | +### Demo App Architecture (`apps/solidjs-boilerplate/`) |
| 41 | +- **Framework**: SolidJS with TypeScript |
| 42 | +- **Styling**: TailwindCSS v4 |
| 43 | +- **Routing**: @solidjs/router |
| 44 | +- **State**: SolidJS signals and stores |
| 45 | +- **Build**: Vite with vite-plugin-solid |
| 46 | +- **Testing**: Vitest for unit tests, Playwright for E2E |
| 47 | + |
| 48 | +## Key Development Details |
| 49 | + |
| 50 | +### CSS Requirements |
| 51 | +The library requires importing CSS from the `hiding-header` package: |
| 52 | +```css |
| 53 | +@import 'node_modules/hiding-header/dist/style.css'; |
| 54 | +``` |
| 55 | + |
| 56 | +### Workspace Dependencies |
| 57 | +The demo app uses the library via workspace reference: |
| 58 | +```json |
| 59 | +"@sect/solid-hiding-header": "workspace:*" |
| 60 | +``` |
| 61 | + |
| 62 | +### Component Usage Pattern |
| 63 | +```tsx |
| 64 | +import { HidingHeader } from '@sect/solid-hiding-header'; |
| 65 | + |
| 66 | +// Basic usage |
| 67 | +<HidingHeader> |
| 68 | + <header>Content</header> |
| 69 | +</HidingHeader> |
| 70 | + |
| 71 | +// With custom component |
| 72 | +<HidingHeader component="header"> |
| 73 | + <div>Content</div> |
| 74 | +</HidingHeader> |
| 75 | +``` |
| 76 | + |
| 77 | +### Testing Approach |
| 78 | +- **Unit Tests**: Vitest with SolidJS Testing Library |
| 79 | +- **E2E Tests**: Playwright for full integration testing |
| 80 | +- **Coverage**: Available via `pnpm coverage` |
| 81 | + |
| 82 | +### Code Quality |
| 83 | +- **ESLint**: Airbnb TypeScript config with SolidJS plugin |
| 84 | +- **Prettier**: Consistent code formatting |
| 85 | +- **Husky**: Pre-commit hooks with lint-staged |
| 86 | +- **Commitlint**: Conventional commit messages |
| 87 | +- **TypeScript**: Strict type checking enabled |
| 88 | + |
| 89 | +### Release Process |
| 90 | +- Uses Changesets for version management |
| 91 | +- `pnpm changeset` - Create changeset |
| 92 | +- `pnpm version-packages` - Update versions |
| 93 | +- `pnpm release` - Build and publish to npm |
0 commit comments