Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
This is a multi-language project with both JavaScript/TypeScript and Rust implementations:
.
├── .github/workflows/ # GitHub Actions CI/CD
├── js/ # JavaScript/TypeScript implementation
│ ├── src/ # Source code
│ ├── test/ # Tests
│ ├── examples/ # Usage examples
│ └── .changeset/ # JS changelog fragments
├── rust/ # Rust implementation
│ ├── src/ # Source code
│ └── changelog.d/ # Rust changelog fragments
├── scripts/ # Shared and language-specific scripts
│ ├── js/ # JS-specific scripts
│ ├── rust/ # Rust-specific scripts
│ └── shared/ # Shared scripts
├── docs/ # Documentation
├── .pre-commit-config.yaml # Pre-commit hooks
├── CONTRIBUTING.md # This file
├── LICENSE # Unlicense (public domain)
└── README.md # Project README
-
Install Node.js (20.x or later recommended)
-
Install dependencies
cd js npm install -
Run quality checks
npm run lint # Run ESLint npm run format:check # Check Prettier formatting npm run check:duplication # Check for code duplication npm test # Run tests
-
Install Rust
Install Rust using rustup (if not already installed):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Install development tools
rustup component add rustfmt clippy
-
Build the project
cd rust cargo build -
Run quality checks
# Format code cargo fmt # Run Clippy lints cargo clippy --all-targets --all-features # Check file sizes node ../scripts/rust/check-file-size.mjs # Run all checks together cargo fmt --check && cargo clippy --all-targets --all-features && node ../scripts/rust/check-file-size.mjs
-
Run tests
cargo test --all-features --verbose cargo test --doc --verbose
Install pre-commit hooks to automatically run quality checks before each commit:
pip install pre-commit
pre-commit install-
Create a feature branch
git checkout -b feature/my-feature
-
Make your changes
- Write code following the project's style guidelines
- Add tests for any new functionality
- Update documentation as needed
-
Add a changelog fragment
For JavaScript changes:
# Create a changeset file in js/.changeset/ cd js && npx changeset
For Rust changes:
# Create a new file in rust/changelog.d/ touch rust/changelog.d/$(date +%Y%m%d_%H%M%S)_description.md
Edit the file with your changes (see rust/changelog.d/README.md for format).
-
Commit your changes
git add . git commit -m "feat: add new feature"
-
Push and create a Pull Request
git push origin feature/my-feature
- ESLint and Prettier for code quality and formatting
- jscpd for duplicate code detection
- Follow existing patterns in the codebase
This project uses:
- rustfmt for code formatting
- Clippy for linting with pedantic and nursery lints enabled
- File size limit of 1000 lines per file
- Follow Rust idioms and best practices
- Use documentation comments (
///) for all public APIs - Write tests for all new functionality
- Keep functions focused and reasonably sized
- Keep files under 1000 lines
- Use meaningful variable and function names
cd js
npm test # Run all tests
bun test # Run with Bun
deno test --allow-read --allow-run --allow-env --allow-net test/**/*.test.mjs # Run with Denocd rust
cargo test --all-features --verbose # Run all tests
cargo test --doc --verbose # Run doc tests
cargo test test_name # Run specific testThis project uses fragment-based changelog systems:
The JS package uses Changesets:
cd js
npx changeset # Create a new changeset interactivelyThe Rust package uses a custom fragment system similar to Scriv:
# Create a fragment
touch rust/changelog.d/$(date +%Y%m%d_%H%M%S)_description.mdFragment format:
---
bump: patch
---
### Fixed
- Description of bug fixSee rust/changelog.d/README.md for detailed instructions.
- Ensure all tests pass locally
- Update documentation if needed
- Add a changelog fragment for user-facing changes
- Ensure the PR description clearly describes the changes
- Link any related issues in the PR description
- Wait for CI checks to pass
- Address any review feedback
This project uses automated releases through GitHub Actions:
- Releases are triggered automatically when changesets are merged to main
- Or manually via workflow dispatch
- Releases are triggered automatically when changelog fragments are merged to main
- Version bumping is determined by the bump type in changelog fragments
- Releases include GitHub release creation and (optionally) crates.io publishing
- Open an issue for bugs or feature requests
- Use discussions for questions and general help
- Check existing issues and PRs before creating new ones
- Be respectful and inclusive
- Provide constructive feedback
- Focus on what is best for the community
- Show empathy towards other community members
Thank you for contributing!