Thank you for your interest in contributing! This document explains how to get started, what the conventions are, and what is required before submitting a pull request.
1. Install system dependencies
# Ubuntu / Debian
sudo apt-get install cmake libopencv-dev llvm clang libclang-dev
# macOS
brew install opencv llvm
# Windows — install OpenCV 4, then set:
# OPENCV_INCLUDE_PATHS, OPENCV_LINK_LIBS, OPENCV_LINK_PATHS2. Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh3. Clone and build (debug)
git clone https://github.com/luckyyyyy/node-opencv.git
cd node-opencv-rs
npm install
npm run build:debug
npm testOn Linux you may need:
export LIBCLANG_PATH=/usr/lib/x86_64-linux-gnu
- Fork the repository and create a feature branch off
main. - Make your changes.
- Run
npm run build:debug && npm test— both must pass before submitting. - Open a pull request with a clear description of what was changed and why.
- No unnecessary
.clone()— Never clone data just to satisfy the borrow checker. Restructure ownership or use references instead. - No unnecessary locking — Acquire a lock once, do all work under it, then release. Never lock/unlock the same value multiple times in a single logical operation.
- Async via
napi::Taskonly — All async operations exposed to JS must usenapi::Task+AsyncTask. Do not usetokio::spawn,#[tokio::main], or any tokio runtime. unsafeblocks must have a// SAFETY:comment explaining the invariant that makes the code safe.- Run
cargo fmtand ensure there are nocargo clippywarnings before submitting.
- Tests live in
tests/*.test.jsand use Node's built-innode:testrunner. - Do not use
awaiton synchronous functions — it compiles but misleads readers. - Add test coverage for any new public API.
- Branch names:
feat/<topic>,fix/<topic>,chore/<topic> - Do not use
git stash— commit work-in-progress with a clear message, then amend/squash before the PR is merged. - Versions follow Semantic Versioning. Releases are triggered by pushing a version tag (
v1.2.3) — the CI/CD pipeline handles building and publishing automatically.
Please open an issue if you find a bug or want to request a feature. Include:
- Node.js version (
node --version) - Operating system and architecture
- OpenCV version (
pkg-config --modversion opencv4) - Minimal reproduction script
By contributing, you agree that your contributions will be licensed under the MIT License.