Contributing
Thank you for your interest in contributing to the Milvus Node.js SDK!
Development Setup
Prerequisites
- Node.js 18+
- Yarn package manager
- Git
Clone Repository
git clone https://github.com/milvus-io/milvus-sdk-node.git
cd milvus-sdk-nodeInstall Dependencies
yarn installFetch Milvus Proto
# Initialize submodules (first time)
git submodule init
# Update submodules
git submodule update --remoteBuild
yarn buildTesting
Run Tests
# Run all tests
yarn test
# Run specific test file
yarn test -- test/Collection.spec.ts
# Run with coverage
yarn coverageTest Structure
Tests are located in the test/ directory:
test/grpc/: gRPC client teststest/http/: HTTP client teststest/utils/: Utility tests
Code Style
TypeScript
- Use TypeScript strict mode
- Follow existing code style
- Use meaningful variable names
- Add JSDoc comments for public APIs
Formatting
Code is automatically formatted. Ensure your editor uses the project’s formatting settings.
Linting
# Check linting
yarn lintAdding Features
1. Create Feature Branch
git checkout -b feature/your-feature-name2. Implement Feature
- Add code in appropriate directory
- Write tests for your feature
- Update documentation if needed
3. Test Your Changes
yarn test
yarn build4. Commit Changes
Follow conventional commit format:
feat: add new feature
fix: fix bug
docs: update documentation
test: add tests5. Push and Create PR
git push origin feature/your-feature-nameThen create a pull request on GitHub.
Pull Request Process
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
- Clear description of changes
- Reference to related issues
- Tests for new features
- Documentation updates
Review Process
- Maintainers will review your PR
- Address any feedback
- Once approved, your PR will be merged
Code Structure
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
milvus/MilvusClient.ts: Main client classmilvus/grpc/: gRPC implementationmilvus/http/: HTTP implementationmilvus/types/: TypeScript type definitions
Testing Guidelines
Write Tests
- Test happy paths
- Test error cases
- Test edge cases
- Mock external dependencies
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
Update Documentation
When adding features:
- Update relevant documentation files
- Add code examples
- Update API reference if needed
Documentation Structure
docs/content/: Documentation source files- Use MDX format
- Include code examples
Reporting Issues
Bug Reports
Include:
- SDK version
- Node.js version
- Steps to reproduce
- Expected vs actual behavior
- Error messages/logs
Feature Requests
Include:
- Use case description
- Proposed solution
- Benefits
Code of Conduct
Please follow the Code of Conduct .
Getting Help
Next Steps
- Read Best Practices
- Check API Reference
- Explore Examples & Tutorials
Last updated on