Before contributing, please read the code of conduct.
Development Workflow
This project is a monorepo managed using Yarn workspaces. It contains:- The library package in the root directory
- An example app in the
example/directory
Getting Started
Check Node.js version
Make sure you have the correct version of Node.js installed. See the
.nvmrc file for the version used in this project.Run the example app
The example app demonstrates usage of the library. You need to run it to test any changes.The example app is configured to use the local version of the library, so changes to JavaScript code will be reflected without a rebuild. Native code changes require rebuilding the example app.
Development Commands
Thepackage.json contains various scripts for common tasks:
Editing Native Code
Android
To edit the Java or Kotlin files:- Open
example/androidin Android Studio - Find source files at
react-native-sherpa-onnxunder Android section
iOS
To edit the Objective-C or Swift files:- Open
example/ios/SherpaOnnxExample.xcworkspacein Xcode - Find source files at Pods β Development Pods β react-native-sherpa-onnx
Building Android Native Libraries
If you need to rebuild the sherpa-onnx Android prebuilts (e.g., after updating the submodule or to enable Qualcomm NPU):Default build does not require the QNN SDK. Use
./build_sherpa_onnx.sh --qnn when QNN_SDK_ROOT is set to build with QNN support.Commit Message Convention
We follow the conventional commits specification:fix:bug fixes (e.g., fix crash due to deprecated method)feat:new features (e.g., add new method to the module)refactor:code refactoring (e.g., migrate from class components to hooks)docs:documentation changes (e.g., add usage example for the module)test:adding or updating tests (e.g., add integration tests using detox)chore:tooling changes (e.g., change CI config)
Our pre-commit hooks verify that your commit message matches this format when committing.
Examples
Sending a Pull Request
When youβre sending a pull request:Keep it focused
Prefer small pull requests focused on one change. This makes review easier and faster.
Pull Request Checklist
- Changes are focused on a single feature/fix
- Code passes
yarn typecheck - Code passes
yarn lint - Tests pass with
yarn test - New tests added for new functionality
- Documentation updated if needed
- Commit messages follow conventional commits
- PR description explains what and why (not just how)
Publishing to npm
We use release-it to handle releases:- Bumping version based on semver
- Creating git tags
- Creating GitHub releases
- Publishing to npm
Code Style
- TypeScript: All new code should be written in TypeScript
- Formatting: Use Prettier (configured in the project)
- Linting: Follow ESLint rules (configured in the project)
- Types: Export all public types
- Documentation: Add JSDoc comments for public APIs
Example
Testing
Running Tests
Writing Tests
Add tests for:- New features
- Bug fixes
- Edge cases
- Error handling
Documentation
Updating Documentation
Documentation is in thedocs/ directory (this documentation site).
When making changes that affect the public API:
- Update relevant documentation pages
- Update code examples
- Update the migration guide if there are breaking changes
- Add/update API reference entries
Documentation Structure
Community
Where to Ask Questions
- GitHub Discussions: For questions and discussions
- GitHub Issues: For bug reports and feature requests
- Pull Requests: For code contributions
Be Respectful
- Be patient with maintainers and other contributors
- Follow the code of conduct
- Provide constructive feedback
- Help others when you can
License
By contributing, you agree that your contributions will be licensed under the projectβs MIT License.Thank You! π
Thank you for contributing to react-native-sherpa-onnx! Your contributions help make speech processing accessible to React Native developers worldwide.View on GitHub
Check out the source code
Example App
Explore the example application
Report Issues
Found a bug? Let us know
Discussions
Join the community