Skip to content

Commit f11b648

Browse files
docs: make contributor setup executable
1 parent 2b16f1c commit f11b648

1 file changed

Lines changed: 34 additions & 20 deletions

File tree

CONTRIBUTING.md

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing to srcmap
22

3-
Thanks for your interest in contributing to srcmap! Whether it's a bug fix, new feature, documentation improvement, or benchmark all contributions are welcome.
3+
Thanks for your interest in contributing to srcmap! Whether it's a bug fix, new feature, documentation improvement, or benchmark, all contributions are welcome.
44

55
## Quick start
66

@@ -9,6 +9,7 @@ Thanks for your interest in contributing to srcmap! Whether it's a bug fix, new
99
- [Rust](https://rustup.rs/) (latest stable, edition 2024)
1010
- [Node.js](https://nodejs.org/) (for running JS tests and benchmarks)
1111
- [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) (for building WASM packages)
12+
- [cargo-deny](https://github.com/EmbarkStudios/cargo-deny) and [typos](https://github.com/crate-ci/typos) (for the root checks)
1213

1314
**Setup:**
1415

@@ -18,13 +19,23 @@ cd srcmap
1819
corepack enable
1920
corepack pnpm install --frozen-lockfile
2021

21-
# Build all Rust crates
22-
cargo build
22+
# Build the Rust workspace
23+
cargo build --workspace
2324

24-
# Run tests
25-
cargo test
25+
# Build the NAPI packages used by the JavaScript tests
26+
corepack pnpm --filter @srcmap/codec build
27+
corepack pnpm --filter @srcmap/sourcemap build
2628

27-
# Run JS tests (requires building NAPI and WASM packages first)
29+
# Build the Node.js and browser WASM packages used by the JavaScript tests
30+
corepack pnpm --filter @srcmap/sourcemap-wasm build:all
31+
corepack pnpm --filter @srcmap/generator-wasm build:all
32+
corepack pnpm --filter @srcmap/remapping-wasm build:all
33+
corepack pnpm --filter @srcmap/symbolicate-wasm build:all
34+
35+
# Run all repository checks
36+
corepack pnpm run check
37+
38+
# Run the Rust and JavaScript test suites
2839
corepack pnpm test
2940
```
3041

@@ -65,16 +76,19 @@ benchmarks/ JS benchmarks comparing against existing libraries
6576
cargo build # Debug build
6677
cargo build --release # Optimized build
6778

68-
# Build a specific WASM package
69-
cd packages/sourcemap-wasm && wasm-pack build --target web
79+
# Build a specific NAPI package
80+
corepack pnpm --filter @srcmap/sourcemap build
81+
82+
# Build a specific WASM package for Node.js and browsers
83+
corepack pnpm --filter @srcmap/sourcemap-wasm build:all
7084
```
7185

7286
### Testing
7387

7488
```bash
7589
cargo test # All Rust tests
7690
cargo test -p srcmap-sourcemap # Single crate
77-
corepack pnpm run test:js # JS/WASM tests
91+
corepack pnpm run test:js # JS/WASM tests (run the binding builds above first)
7892
```
7993

8094
### Benchmarks
@@ -84,7 +98,7 @@ corepack pnpm run test:js # JS/WASM tests
8498
cargo bench -p srcmap-sourcemap
8599

86100
# JS benchmarks (comparison with other libraries)
87-
corepack pnpm --dir benchmarks exec node sourcemap-wasm.mjs
101+
corepack pnpm --dir benchmarks run bench:wasm
88102
```
89103

90104
### Coverage
@@ -96,7 +110,7 @@ corepack pnpm run coverage:js # JS coverage
96110

97111
## Code standards
98112

99-
- **Formatting:** `cargo fmt` is enforced by a pre-commit hook and CI. Run it before committing.
113+
- **Formatting:** `cargo fmt` is enforced by CI. Run it before committing.
100114
- **Linting:** `cargo clippy` must pass without warnings.
101115
- **Tests:** Add or update tests for any changed behavior. All crates should maintain good test coverage.
102116
- **Documentation:** Public APIs should have doc comments. Use `cargo doc --open` to preview.
@@ -105,21 +119,21 @@ corepack pnpm run coverage:js # JS coverage
105119

106120
We use [conventional commits](https://www.conventionalcommits.org/):
107121

108-
- `feat:` new feature
109-
- `fix:` bug fix
110-
- `refactor:` code change that neither fixes a bug nor adds a feature
111-
- `test:` adding or updating tests
112-
- `docs:` documentation only
113-
- `chore:` maintenance, CI, dependencies
114-
- `perf:` performance improvement
122+
- `feat:`: new feature
123+
- `fix:`: bug fix
124+
- `refactor:`: code change that neither fixes a bug nor adds a feature
125+
- `test:`: adding or updating tests
126+
- `docs:`: documentation only
127+
- `chore:`: maintenance, CI, dependencies
128+
- `perf:`: performance improvement
115129

116130
Example: `feat: add name resolution to scopes decoder`
117131

118132
## Pull request process
119133

120134
1. Fork the repo and create a branch from `main`.
121-
2. Make your changes, ensuring `cargo fmt`, `cargo clippy`, and `cargo test` all pass.
122-
3. Write a clear PR description — the repo has a [PR template](.github/PULL_REQUEST_TEMPLATE.md) to guide you.
135+
2. Make your changes, ensuring `corepack pnpm run check` and `corepack pnpm test` both pass.
136+
3. Write a clear PR description. The repo has a [PR template](.github/PULL_REQUEST_TEMPLATE.md) to guide you.
123137
4. For performance-sensitive changes, include benchmark results.
124138
5. Keep PRs focused. Prefer smaller, reviewable changes over large ones.
125139

0 commit comments

Comments
 (0)