|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `pages/`: Next.js pages and MDX docs (Nextra). Route files use kebab-case. |
| 5 | +- `components/`: Reusable React components (PascalCase filenames). |
| 6 | +- `lib/`: Local utilities/helpers imported by pages/components. |
| 7 | +- `public/`: Static assets (images, favicons, robots, sitemap output). |
| 8 | +- `.storybook/`: Storybook configuration and stories in `stories/`. |
| 9 | +- `deno_scripts/`: Deno-based tooling and doc code-block tests. |
| 10 | +- `styles/` and `style.css`: Global styles and Tailwind setup. |
| 11 | + |
| 12 | +## Build, Test, and Development Commands |
| 13 | +- `pnpm install`: Install dependencies (pnpm is required). |
| 14 | +- `pnpm dev`: Run Next.js dev server. |
| 15 | +- `pnpm build`: Generate RSS then build Next.js (`gen-rss.js`, `next build`). |
| 16 | +- `pnpm start`: Serve the production build. |
| 17 | +- `pnpm test`: Execute Deno-powered code-block tests across docs. |
| 18 | +- `pnpm storybook` / `pnpm build-storybook`: Run/build Storybook. |
| 19 | + |
| 20 | +## Coding Style & Naming Conventions |
| 21 | +- Language: TypeScript + React (function components). |
| 22 | +- Indentation: 2 spaces; keep files focused and small. |
| 23 | +- Naming: PascalCase for components (`components/CodeBlock.tsx`), camelCase for vars, kebab-case routes (`pages/api/route-name.ts`). |
| 24 | +- Styling: TailwindCSS utilities; prefer composable classes over custom CSS. |
| 25 | +- Imports: Use module paths relative to file; docs code blocks may import from `loro-crdt` directly. |
| 26 | + |
| 27 | +## Testing Guidelines |
| 28 | +- Framework: Deno executes TS code blocks extracted from `.md|.mdx`. |
| 29 | +- Run: `pnpm test` (or `cd deno_scripts && deno run -A run_code_blocks.ts ..`). |
| 30 | +- Expectations: Use `expect` assertions where relevant in examples. |
| 31 | +- Authoring docs: Ensure code blocks are self-contained TS snippets; they should compile and run without external context. |
| 32 | + |
| 33 | +## Commit & Pull Request Guidelines |
| 34 | +- Commits: Follow Conventional Commits (e.g., `docs: ...`, `fix: ...`, `feat: ...`, `test: ...`, `ui: ...`). |
| 35 | +- PRs: Provide a clear summary, link related issues, include screenshots/gifs for UI/docs changes, and list test steps. |
| 36 | +- Checks: Run `pnpm build` and `pnpm test` locally before requesting review. |
| 37 | + |
| 38 | +## Security & Configuration Tips |
| 39 | +- Node: Use the version compatible with Next 14; install via nvm. |
| 40 | +- Secrets: Do not commit tokens or API keys; prefer env vars if needed. |
0 commit comments