Contributing
Thank you for your interest in contributing to the Milvus Node.js SDK!
Development Setup
Section titled “Development Setup”Prerequisites
Section titled “Prerequisites”- Node.js 18+
- Yarn package manager
- Git
Clone Repository
Section titled “Clone Repository”git clone https://github.com/milvus-io/milvus-sdk-node.gitcd milvus-sdk-nodeInstall Dependencies
Section titled “Install Dependencies”yarn installFetch Milvus Proto
Section titled “Fetch Milvus Proto”# Initialize submodules (first time)git submodule init
# Update submodulesgit submodule update --remoteyarn buildTesting
Section titled “Testing”Run Tests
Section titled “Run Tests”# Run all testsyarn test
# Run specific test fileyarn test -- test/Collection.spec.ts
# Run with coverageyarn coverageTest Structure
Section titled “Test Structure”Tests are located in the test/ directory:
test/grpc/: gRPC client teststest/http/: HTTP client teststest/utils/: Utility tests
Code Style
Section titled “Code Style”TypeScript
Section titled “TypeScript”- Use TypeScript strict mode
- Follow existing code style
- Use meaningful variable names
- Add JSDoc comments for public APIs
Formatting
Section titled “Formatting”Code is automatically formatted. Ensure your editor uses the project’s formatting settings.
Linting
Section titled “Linting”# Check lintingyarn lintAdding Features
Section titled “Adding Features”1. Create Feature Branch
Section titled “1. Create Feature Branch”git checkout -b feature/your-feature-name2. Implement Feature
Section titled “2. Implement Feature”- Add code in appropriate directory
- Write tests for your feature
- Update documentation if needed
3. Test Your Changes
Section titled “3. Test Your Changes”yarn testyarn build4. Commit Changes
Section titled “4. Commit Changes”Follow conventional commit format:
feat: add new featurefix: fix bugdocs: update documentationtest: add tests5. Push and Create PR
Section titled “5. Push and Create PR”git push origin feature/your-feature-nameThen create a pull request on GitHub.
Pull Request Process
Section titled “Pull Request Process”Before Submitting
Section titled “Before Submitting”- Update Tests: Ensure all tests pass
- Update Documentation: Add/update docs for new features
- Check Linting: Fix any linting errors
- Review Changes: Review your own changes
PR Requirements
Section titled “PR Requirements”- Clear description of changes
- Reference to related issues
- Tests for new features
- Documentation updates
Review Process
Section titled “Review Process”- Maintainers will review your PR
- Address any feedback
- Once approved, your PR will be merged
Code Structure
Section titled “Code Structure”Directory Structure
Section titled “Directory Structure”milvus-sdk-node/├── milvus/ # Main SDK code│ ├── grpc/ # gRPC client│ ├── http/ # HTTP client│ ├── types/ # TypeScript types│ └── utils/ # Utilities├── test/ # Tests├── examples/ # Examples└── docs/ # DocumentationKey Files
Section titled “Key Files”milvus/MilvusClient.ts: Main client classmilvus/grpc/: gRPC implementationmilvus/http/: HTTP implementationmilvus/types/: TypeScript type definitions
Testing Guidelines
Section titled “Testing Guidelines”Write Tests
Section titled “Write Tests”- Test happy paths
- Test error cases
- Test edge cases
- Mock external dependencies
Test Example
Section titled “Test Example”describe('createCollection', () => { it('should create collection successfully', async () => { const result = await client.createCollection({ collection_name: 'test_collection', fields: schema, });
expect(result.error_code).toBe('Success'); });});Documentation
Section titled “Documentation”Update Documentation
Section titled “Update Documentation”When adding features:
- Update relevant documentation files
- Add code examples
- Update API reference if needed
Documentation Structure
Section titled “Documentation Structure”docs/src/content/docs/: Documentation source files- Use MDX format
- Include code examples
Reporting Issues
Section titled “Reporting Issues”Bug Reports
Section titled “Bug Reports”Include:
- SDK version
- Node.js version
- Steps to reproduce
- Expected vs actual behavior
- Error messages/logs
Feature Requests
Section titled “Feature Requests”Include:
- Use case description
- Proposed solution
- Benefits
Code of Conduct
Section titled “Code of Conduct”Please follow the Code of Conduct.
Getting Help
Section titled “Getting Help”Next Steps
Section titled “Next Steps”- Read Best Practices
- Check API Reference
- Explore Examples & Tutorials