|
| 1 | +# Repository guidelines |
| 2 | + |
| 3 | +## Project structure & module organization |
| 4 | + |
| 5 | +- Monorepo via `pnpm` + `Nx`. |
| 6 | +- Packages: `packages/core` (CLI + `@rslib/core`), `packages/plugin-dts` (DTS plugin), `packages/create-rslib` (scaffolder). |
| 7 | +- Tests: `packages/*/tests` (unit) and `tests/` (`integration`, `e2e`, `benchmark`); examples in `examples/`. |
| 8 | +- Key config: `nx.json`, `biome.json`, `.prettierrc.json`, `rslint.jsonc`, `pnpm-workspace.yaml`. |
| 9 | + |
| 10 | +## Build, test, and development commands |
| 11 | + |
| 12 | +- Install: `pnpm install` (Node >= 18.12, pnpm >= 10.15). |
| 13 | +- Build: `pnpm build` (all) and `pnpm build:examples`. |
| 14 | +- Watch dev: `pnpm -C packages/core dev` (or other package). |
| 15 | +- Lint/format: `pnpm lint`; auto-fix: `pnpm format`. |
| 16 | +- Type-check: `pnpm type-check`. |
| 17 | +- Tests: `pnpm test`; targeted: `test:unit|:integration|:e2e|:benchmark`; update snapshots: `pnpm testu`. |
| 18 | + |
| 19 | +## Coding style & naming conventions |
| 20 | + |
| 21 | +- TypeScript + ESM; spaces; single quotes. |
| 22 | +- Biome is canonical linter/formatter; Prettier formats MD/CSS/JSON and `package.json`. |
| 23 | +- Filenames: `camelCase` or `PascalCase` (Biome enforced). |
| 24 | + |
| 25 | +## Testing guidelines |
| 26 | + |
| 27 | +- Unit/integration: `@rstest/core`; E2E: `@playwright/test`. |
| 28 | +- Naming: `*.test.ts`/`*.test.tsx`; snapshots in `__snapshots__/`. |
| 29 | +- Placement: unit under `packages/*/tests`; integration under `tests/integration`; e2e under `tests/e2e`. |
| 30 | + |
| 31 | +## Commit & pull request guidelines |
| 32 | + |
| 33 | +- Conventional Commits (e.g., `fix(dts): ...`); keep commits focused; run lint + tests. |
| 34 | +- User-facing changes need a Changeset (`pnpm changeset`); PRs should include description, linked issues, and doc/example updates when needed. |
| 35 | + |
| 36 | +## Architecture overview |
| 37 | + |
| 38 | +- `packages/core` (`@rslib/core`): CLI `rslib build` (add `--watch`), config via `rslib.config.ts` using `defineConfig`; programmatic `import { build, defineConfig, loadConfig } from '@rslib/core'`. |
| 39 | +- `packages/plugin-dts` (`rsbuild-plugin-dts`): detail implementation of `dts` in `rslib.config.ts` (e.g., `{ dts: { bundle: true } }`); |
| 40 | +- `packages/create-rslib` (`create-rslib`): scaffold new projects/templates with `pnpm dlx create-rslib` (or `npx create-rslib`). |
| 41 | + |
| 42 | +## Security & configuration tips |
| 43 | + |
| 44 | +- Do not commit build artifacts (`dist/`, `compiled/`). |
| 45 | +- Nx caching is enabled; scripts use `NX_DAEMON=false` for reproducible CI. |
0 commit comments