Contributing to Schema Benchmarks
Firstly, thank you for wanting to contribute! Ideas for improvements are always welcome, and pull requests are even better.
Getting set up
- Fork the repository
- Clone your fork
- Install pnpm with
corepack enable(or a method of your choice) - Install dependencies with
pnpm install - Install Playwright with
pnpm exec playwright install --with-deps chromium(needed for browser tests) - Build the schemas with
pnpm schemas:build - Run the website with
pnpm website:dev
Adding a new library
- Add the library to the dependencies of the
schemaspackage. (pnpm --filter schemas add <library>) - Create a new folder in
schemas/librariesnamed after the library. - Add a
index.tsfile with the schema definition. Usually this should be a single function that creates and returns the schema - any other values and types can be exported as well. The schema should match as much of the validation specified as possible. Use existing library schema factories as a reference. - Add a
benchmarks.tsfile with the benchmark definitions. Use other benchmarks as a reference. - Create download benchmarks (usually just a single
download.tsfile, but can be adownload/folder with multiple files). This should match how the library would typically be used, matching the specified data type. - Build the schema package with
pnpm schemas:build - Run the benchmarks with
pnpm bench:allto check all is working, but do not commit the changed results (GitHub will push them after you open a PR) - Open a PR with your changes.
Bug reports/feature requests
Please open an issue for any bugs you find, or features you would like to see. Opening a PR without confirmation it's desired means it may not be merged.
Make sure any changes meet our coding standards. We lint with oxlint and format with oxfmt, type check using TypeScript (specifically TS Go) and test using Vitest.
Prefer browser tests (*.browser.test.ts(x)) for anything needing DOM specific features (e.g. React components), and Node tests (*.node.test.ts) for everything else. Include type tests (*.test-d.ts) for anything with complex typing.
The following commands will help you check your changes before opening a PR:
pnpm check- runs lint and format checkspnpm typecheck- runs type checkspnpm test- runs tests
PRs written by AI
Please do not submit PRs solely written by AI. There's nothing wrong with using an assistant to speed up the process, but you should (at the very least) always review and test the changes yourself before submitting. Opening "slop" PRs is inconsiderate and only adds to the workload of the maintainers.