|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure |
| 4 | + |
| 5 | +- `mod.ts`: Public entrypoint (re-exports the library surface). |
| 6 | +- `src/`: Library implementation (TypeScript). Core modules include `Parser.ts`, |
| 7 | + `combinators.ts`, and `parsers.ts`. |
| 8 | +- `tests/`: Deno tests (`*.test.ts`) using `Deno.test` and `@std/assert`. |
| 9 | +- `examples/`: Small runnable examples. |
| 10 | +- `bench/`: Benchmarks (excluded from publishing). |
| 11 | +- `scripts/`: Repo tooling (notably npm build tooling). |
| 12 | +- `npm/`: Generated npm publish artifact (do not edit by hand; do not commit |
| 13 | + changes). |
| 14 | + |
| 15 | +## Build, Test, and Development Commands |
| 16 | + |
| 17 | +Run these from the repo root: |
| 18 | + |
| 19 | +- `deno task check`: Formats, lints, and runs tests |
| 20 | + (`deno fmt && deno lint && deno test --ignore=npm`). |
| 21 | +- `deno test`: Run the test suite. |
| 22 | +- `deno fmt`: Auto-format code and Markdown. |
| 23 | +- `deno lint`: Static analysis for TS/JS. |
| 24 | +- `deno task build:npm`: Generates the npm package into `npm/` using |
| 25 | + `@deno/dnt`. |
| 26 | + |
| 27 | +Tip: install the local git hook with `deno task hooks:install` (runs the same |
| 28 | +checks on commit). |
| 29 | + |
| 30 | +## Coding Style & Naming Conventions |
| 31 | + |
| 32 | +- Use `deno fmt` as the source of truth for formatting. |
| 33 | +- Prefer explicit types for exported functions/types. |
| 34 | +- File naming follows existing patterns: core types in `PascalCase.ts` (ex: |
| 35 | + `Parser.ts`), utilities in `camelCase.ts` (ex: `combinators.ts`). |
| 36 | +- Keep runtime code dependency-free and Node-compatible (tests may use |
| 37 | + Deno/JSR-only deps). |
| 38 | + |
| 39 | +## Testing Guidelines |
| 40 | + |
| 41 | +- Tests live in `tests/` and should be named `*.test.ts`. |
| 42 | +- Use `@std/assert` assertions and deterministic inputs (no network/time |
| 43 | + dependencies). |
| 44 | + |
| 45 | +## Commit & Pull Request Guidelines |
| 46 | + |
| 47 | +- Commit messages generally follow Conventional Commits: `feat(...)`, |
| 48 | + `fix(...)`, `chore:`, `docs:`. |
| 49 | +- PRs should include: what changed, why, and how to validate (commands run). |
| 50 | + Link an issue if applicable. |
| 51 | + |
| 52 | +## Release / Publishing |
| 53 | + |
| 54 | +- `deno.json` is the version source of truth. |
| 55 | +- Tag releases as `vX.Y.Z` (example: `v0.2.4`). The GitHub workflow publishes to |
| 56 | + JSR, then builds and publishes `./npm` to npm (requires `NPM_TOKEN` secret). |
0 commit comments