Thank you for your interest in contributing to toml-patch!
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/toml-patch.git - Install dependencies:
pnpm install - Update submodules:
git submodule update --init --remote
The project includes several submodules for testing and compliance:
submodules/spec-tests- TOML specification test suitesubmodules/toml-test- Additional TOML test casessubmodules/iarna-toml- Reference implementation for benchmarking
To update all submodules to their latest versions:
git submodule update --remoteThis should be done periodically to ensure the project remains compatible with the latest TOML specifications and test cases.
Before building or testing, ensure there are no type errors:
pnpm run typecheckThis runs TypeScript's type checker without emitting any files. Fix any type errors before proceeding with builds or pull requests.
To compile the TypeScript source code into distributable JavaScript:
pnpm run buildThis command:
- Cleans the
dist/directory - Runs Rollup to bundle the code
- Generates ESM (ES modules) format output
- Creates TypeScript declaration files
The build outputs are:
dist/toml-patch.js- ESM format (for Node.js and modern bundlers)dist/toml-patch.d.ts- TypeScript type declarations
To run the main test suite:
pnpm testThis executes all tests in the src/__tests__/ directory using Jest.
To test the built JavaScript output:
pnpm run test:jsThis ensures the compiled JavaScript works correctly.
pnpm run test:allThis runs both the TypeScript and JavaScript test suites.
To verify compliance with the TOML specification:
pnpm run specsThis runs tests against the official TOML spec test cases from the submodules.
To measure performance:
pnpm run benchmarkThis runs benchmarks for both parsing and stringifying operations. To see example outputs:
pnpm run benchmark:exampleFor a full development cycle (typecheck, build, and test everything):
pnpm run devThis command runs typechecking, builds the project, and then runs all tests and spec compliance checks in parallel.
- Create a new branch for your feature or fix:
git checkout -b my-feature-branch - Make your changes
- Update the CHANGELOG.md - Add an entry describing your changes under the
[Unreleased]section - Run
pnpm run typecheckto ensure no type errors - Run
pnpm run buildto compile your changes - Run
pnpm run test:allto verify all tests pass - Run
pnpm run specsto ensure TOML spec compliance - Commit your changes with a descriptive message
- Push to your fork and submit a pull request
For a pull request to be accepted, it must:
- Include a CHANGELOG entry - All PRs must update the CHANGELOG.md file with a description of the changes. Add your entry under the
[Unreleased]section following the existing format. - Pass all tests (
pnpm run test:all) - Pass TOML specification compliance checks (
pnpm run specs) - Pass type checking (
pnpm run typecheck) - Include tests for new features or bug fixes
- Follow the existing code style and conventions
- Update relevant documentation as needed
- Follow the existing code style and conventions
- Write tests for new features or bug fixes
- Update documentation as needed
- Ensure all tests pass before submitting a pull request