Thank you for your interest in contributing to react-native-cozo! This document provides guidelines and instructions for contributors.
- Be respectful and inclusive
- Provide constructive feedback
- Focus on the code, not the person
- Node.js 18+ (use nvm for version management)
- React Native development environment set up
- Xcode (for iOS development)
- Android Studio (for Android development)
# Clone the repository
git clone https://github.com/AdebisiJoe/react-native-cozo.git
cd react-native-cozo
# Install dependencies
npm install
# Build the library
npm run buildfeature/- New featuresfix/- Bug fixesdocs/- Documentation updatesrefactor/- Code refactoringtest/- Test additions/updates
Follow Conventional Commits:
feat: add new feature
fix: fix bug in translator
docs: update README
test: add translator tests
refactor: improve code structure
# Run all tests
npm test
# Run tests with coverage report
npm run test:coverage
# Run specific test file
npm test -- --testPathPattern=translator
# Run tests in watch mode (re-runs on file changes)
npm test -- --watch
# Run only failed tests
npm test -- --onlyFailures| Test File | Description | Tests |
|---|---|---|
translator.test.ts |
Cypher-to-Datalog translation | 75+ |
lexer.test.ts |
Cypher query tokenization | 50+ |
parser.test.ts |
Cypher AST parsing | 60+ |
database.test.ts |
Database operations (mocked) | 20+ |
serialization.test.ts |
Value serialization utilities | 15+ |
errors.test.ts |
Error handling | 10+ |
All PRs must maintain minimum coverage thresholds:
- Branches: 70%
- Functions: 80%
- Lines: 80%
- Statements: 80%
Run npm run test:coverage to check coverage before submitting.
When adding new features:
- Write tests first (TDD encouraged)
- Ensure tests are descriptive
- Cover edge cases
- Include both positive and negative test cases
Example test structure:
describe('FeatureName', () => {
describe('methodName', () => {
it('should handle normal case', () => {
// Test code
});
it('should handle edge case', () => {
// Test code
});
it('should throw error for invalid input', () => {
expect(() => method(invalidInput)).toThrow();
});
});
});# Run ESLint
npm run lint
# Auto-fix linting issues
npm run lint -- --fix# Run TypeScript compiler
npm run typecheck- Use TypeScript for all new code
- Follow existing code patterns
- Add JSDoc comments for public APIs
- Keep functions small and focused
- Avoid premature optimization
# Build the library
npm run build
# Build the config plugin
npm run build:plugin
# Clean build artifacts
npm run cleancd example
npm install
cd ios && pod install && cd ..
npx expo run:ioscd example
npm install
npx expo run:android- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
npm test - Run linting:
npm run lint - Run type check:
npm run typecheck - Update documentation if needed
- Submit PR with clear description
- Tests pass locally
- Coverage thresholds maintained
- Linting passes
- TypeScript compiles without errors
- Documentation updated (if applicable)
- Commit messages follow conventions
- PR description explains the changes
When modifying the Cypher-to-Datalog translator:
- Test with real CozoDB - Ensure generated Datalog actually executes
- Match CozoDB syntax - Use
*Relation{col1, col2}format - Comma separation - Datalog clauses are comma-separated
- Add tests - Every new feature needs corresponding tests
- Document limitations - Note any unsupported Cypher features
Example valid CozoDB output:
?[name, title] := *Employee{name, title, department}, department == "Engineering"
When reporting bugs:
- Check existing issues first
- Include reproduction steps
- Include environment info (OS, Node version, RN version)
- Include error messages/stack traces
- Include minimal code example if possible
- Open a GitHub issue for questions
- Tag with
questionlabel
Thank you for contributing!