|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `src/` hosts all TypeScript sources (`index.ts`, `prebundle.ts`, helpers, shared `types.ts`); export public symbols through `src/index.ts`. |
| 5 | +- `dist/` holds `rslib` output and must stay generated-only, while `compiled/` stores bundled dependencies produced by the CLI; never edit either manually. |
| 6 | +- `bin.js` is the CAC-based CLI entry; root configs (`prebundle.config.ts`, `rslib.config.ts`, `tsconfig.json`) govern build targets and should evolve together. |
| 7 | +- `tests/` contains `@rstest/core` suites plus fixture configs under `tests/fixtures/` used to exercise the CLI. |
| 8 | + |
| 9 | +## Build, Test, and Development Commands |
| 10 | +- `pnpm install` respects `pnpm-lock.yaml`; mixing package managers is forbidden to avoid dependency drift. |
| 11 | +- `pnpm dev` runs `rslib build --watch` for tight feedback while hacking on `src/`. |
| 12 | +- `pnpm build` generates production artifacts and doubles as a pre-publish smoke test; run it before every PR or release. |
| 13 | +- `pnpm test` triggers `pnpm build && rstest`, which runs the CLI integration suite. |
| 14 | +- `pnpm prebundle [pkg1 pkg2 ...] --config path/to/config` executes the CLI for all configured dependencies or a filtered subset; use `--config` to point at custom fixtures. |
| 15 | +- `pnpm bump` wraps `npx bumpp` for releases; only call after `dist/` and configs are committed. |
| 16 | + |
| 17 | +## Coding Style & Naming Conventions |
| 18 | +- The repo is pure ESM (`type: module`), so keep relative imports with explicit `.js` extensions that mirror emitted files. |
| 19 | +- Apply `Prettier` defaults (2-space indent, single quotes, trailing commas) before committing; configure your editor to format on save. |
| 20 | +- Prefer `camelCase` for functions, `PascalCase` for types/interfaces, and SCREAMING_SNAKE_CASE for constants stored in `constant.ts`. |
| 21 | +- Keep modules focused; common utilities belong in `helper.ts`, and shared configuration goes through `src/types.ts` for better type inference. |
| 22 | + |
| 23 | +## Testing Guidelines |
| 24 | +- Automated coverage uses `@rstest/core` in `tests/prebundle.test.ts` to snapshot bundled output and execute the emitted modules; add new cases there or create additional suites under `tests/`. |
| 25 | +- Prefer end-to-end checks that run `bin.js --config <fixture>` so the CLI path stays covered across platforms. |
| 26 | +- When adding manual validation steps (e.g., testing new dependencies), document the exact `pnpm prebundle ...` invocation and observed artifacts in the PR description. |
| 27 | + |
| 28 | +## Commit & Pull Request Guidelines |
| 29 | +- Follow Conventional Commits mirroring existing history (`feat:`, `fix(deps):`, `chore:`); add scopes like `feat(cli):` when touching a specific module. |
| 30 | +- Each PR should describe the motivation, list the commands you ran (`pnpm build`, `pnpm prebundle commander`, etc.), and reference related issues. |
| 31 | +- Separate mechanical refactors from behavior changes to keep diffs reviewable, and ensure CI or manual checks are linked before requesting review. |
0 commit comments