Contributing
Development setup
Section titled “Development setup”-
Fork and clone
Terminal window git clone https://github.com/sqrcz/numerik-js.gitcd numerik-js -
Install dependencies
Terminal window pnpm install -
Run the test suite
Terminal window pnpm test
Local checks
Section titled “Local checks”| Command | What it runs |
|---|---|
pnpm test | Vitest test suite |
pnpm test:watch | Vitest in watch mode |
pnpm test:cover | Vitest with coverage |
pnpm typecheck | tsc --noEmit |
pnpm lint | Biome lint + format check |
pnpm lint:fix | Biome lint + format — auto-fix |
pnpm build | Compile to dist/ |
pnpm check | typecheck + lint + test in sequence |
Run pnpm check before opening a PR to catch all issues locally.
Adding a new identifier
Section titled “Adding a new identifier”Adding a new identifier requires touching several files. PRs missing any item will not be merged:
- Create
src/value-objects/NewIdentifier.ts(implementsIdentifierInterface) - Create
src/identifiers/NewIdentifierIdentifier.ts(implements bothValidatorInterfaceandParserInterface; acceptsstrict: boolean = true) - Add new
ValidationFailureReasoncases if the identifier introduces new failure types - Add an entry to
src/Numerik.tsand export it fromsrc/index.ts - Add Zod schemas to
src/zod/index.ts - Add
tests/new-identifier.test.ts - Add an identifier page under
docs/src/content/docs/identifiers/ - Update
CHANGELOG.md
Branch naming
Section titled “Branch naming”| Type | Pattern | Example |
|---|---|---|
| Feature | feat/<short-name> | feat/passport-identifier |
| Fix | fix/<short-name> | fix/pesel-century-calc |
| Chore | chore/<short-name> | chore/update-dependencies |
Commit style
Section titled “Commit style”Use Conventional Commits:
feat: add PassportIdentifierfix: correct PESEL century calculation for 2000sdocs: update REGON algorithm descriptiontest: add NIP fixtures for invalid tax office codeschore: bump vitest to 4.xrefactor: extract checksum calculation to dedicated methodPull request process
Section titled “Pull request process”- Fork the repository and create your branch from
main. - Add tests for any new behaviour — all tests must pass.
- Ensure
pnpm checkpasses. - Open a PR against
mainand fill in the template completely.
Reporting a bug
Section titled “Reporting a bug”Use the Bug Report template on GitHub.
Security vulnerabilities
Section titled “Security vulnerabilities”Do not open a public issue. Report via GitHub’s private advisory system. See SECURITY.md.