|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for your interest in contributing to `nj.rs`! This is a Cargo workspace |
| 4 | +that ships three artifacts from one core crate: |
| 5 | + |
| 6 | +- `nj/` — core Rust library + CLI (the `cli` and `parallel` features are optional) |
| 7 | +- `python/` — PyO3 bindings published to PyPI as `nj_py` |
| 8 | +- `wasm/` — wasm-bindgen bindings published to npm as `@holmrenser/nj` |
| 9 | + |
| 10 | +## Building & testing |
| 11 | + |
| 12 | +```bash |
| 13 | +make all # build library, CLI, Python, and WASM |
| 14 | +make test # run Rust (incl. cli + parallel), WASM (node + web), and Python tests |
| 15 | +make bench # run the criterion benchmarks |
| 16 | +``` |
| 17 | + |
| 18 | +You can also test pieces individually: |
| 19 | + |
| 20 | +```bash |
| 21 | +cargo test -p nj # core unit + integration tests |
| 22 | +cargo test -p nj --features parallel # exercise the parallel bootstrap path |
| 23 | +make -C python test # maturin develop + pytest (needs maturin + uv) |
| 24 | +make -C wasm test # wasm-pack build + node/web tests (needs wasm-pack + node) |
| 25 | +``` |
| 26 | + |
| 27 | +Please add tests with any behavioural change. Cross-cutting changes to the core |
| 28 | +API should be reflected in the Python (`python/tests/`) and WASM |
| 29 | +(`wasm/tests/`) suites where relevant. |
| 30 | + |
| 31 | +## Documentation single source of truth |
| 32 | + |
| 33 | +The root `README.md` is the **only** committed README. It is copied into |
| 34 | +`python/` and `wasm/` at release time and is git-ignored there, so never commit |
| 35 | +`python/README.md` or `wasm/README.md`. |
| 36 | + |
| 37 | +## Releasing |
| 38 | + |
| 39 | +All three packages share one version. Bump them together — never edit the |
| 40 | +version strings by hand: |
| 41 | + |
| 42 | +```bash |
| 43 | +make bump-patch # or bump-minor / bump-major |
| 44 | +``` |
| 45 | + |
| 46 | +`release.sh` (invoked by `make bump-*`) requires `cargo-workspaces`, `toml`, |
| 47 | +`jq`, and `sponge` on `PATH`. It bumps the Cargo workspace version, syncs |
| 48 | +`python/pyproject.toml` and `wasm/package.json`, runs `scripts/check-versions.sh` |
| 49 | +to confirm they agree, then creates a `Release vX.Y.Z` commit and tag. |
| 50 | + |
| 51 | +Pushing a `vX.Y.Z` tag triggers `.github/workflows/release.yml`, which runs the |
| 52 | +full test matrix, re-verifies the version, and publishes to crates.io, PyPI |
| 53 | +(OIDC trusted publishing), and npm (OIDC + provenance). |
| 54 | + |
| 55 | +You can sanity-check version consistency at any time: |
| 56 | + |
| 57 | +```bash |
| 58 | +bash scripts/check-versions.sh |
| 59 | +``` |
0 commit comments