Thank you for your interest in contributing! This document provides guidelines for contributing to this project.
- Node.js >= 20.19.4
- npm
- Xcode 16.0+ (for iOS development)
- An Apple Silicon device (iPhone 15 Pro+, M-series Mac) for testing
- Fork and clone the repository:
git clone https://github.com/drewalth/react-native-foundation-models.git
cd react-native-foundation-models- Install dependencies:
npm install- Build the module:
npm run build- Run linting:
npm run lint- Run tests:
npm testThe example/ directory contains a test application:
cd example
npm install
npx expo prebuild
npm run ios # or npm run androidWe use ESLint for JavaScript/TypeScript and SwiftLint for Swift code:
npm run lint # Run all linters
npm run lint:js # JavaScript/TypeScript only
npm run lint:swift # Swift onlyWe use Prettier for JavaScript/TypeScript and SwiftFormat for Swift:
npm run format # Format all code
npm run format:js # JavaScript/TypeScript only
npm run format:swift # Swift onlyWrite tests for new features and bug fixes:
npm test # Run all tests
npm test -- --coverage # Run with coverage reportWe follow the Conventional Commits specification:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changeschore:- Build process or auxiliary tool changesrefactor:- Code refactoringtest:- Adding or updating testsci:- CI configuration changes
Example:
git commit -m "feat: add streaming support for responses"
git commit -m "fix: handle tool call errors correctly"
git commit -m "docs: update README with streaming examples"Commits are automatically validated using husky and commitlint.
- Create a feature branch:
git checkout -b feat/your-feature-name-
Make your changes and commit following the commit convention
-
Ensure all tests pass and code is linted:
npm run lint
npm test
npm run build-
Push your branch and create a Pull Request
-
Fill out the PR template with:
- Description of changes
- Related issues (if any)
- Testing steps
- Screenshots (if UI changes)
-
Wait for review and address feedback
- Add your code in
src/ - Update types in
src/ReactNativeFoundationModels.types.tsif needed - Export from
src/index.ts - Add tests in
src/__tests__/ - Update documentation
- Add code in
ios/ - Follow existing patterns for module exports
- Document native methods with comments
- Test on a physical device (FoundationModels requires Apple Silicon)
- Modify
plugin/src/ - Update types in
plugin/src/types.ts - Test with
npx expo prebuildin the example app
- Update README.md for user-facing changes
- Add JSDoc comments to public APIs
- Include code examples for new features
- Update CHANGELOG.md (handled automatically by semantic-release)
Releases are automated using semantic-release:
- Merge PRs to
main(for stable releases) - semantic-release analyzes commits
- Generates changelog
- Publishes to npm
- Creates GitHub release
For pre-releases:
- Merge to
betabranch for beta releases - Merge to
nextbranch for next releases
- Bug reports: Open an issue
- Feature requests: Open an issue with the
enhancementlabel - Questions: Use GitHub Discussions
By contributing, you agree that your contributions will be licensed under the MIT License.