Skip to content

Latest commit

 

History

History
226 lines (160 loc) · 3.98 KB

File metadata and controls

226 lines (160 loc) · 3.98 KB

Contributing to RPC Worker Pool

Development Environment Setup

Prerequisites

  1. Node.js v22 or later
  2. pnpm package manager
  3. Docker (optional, for containerized development)
  4. Git

Initial Setup

  1. Fork the repository

  2. Clone your fork:

    git clone <your-fork-url>
    cd rpc-worker-pool
  3. Install dependencies:

    pnpm install
  4. Build the project:

    pnpm run build

Development Workflow

Branch Strategy

  • main - Stable release branch
  • develop - Development branch
  • Feature branches: feature/<feature-name>
  • Bug fixes: fix/<bug-description>
  • Hotfixes: hotfix/<description>

Coding Standards

TypeScript Guidelines

  1. Type Safety

    • Enable strict TypeScript configuration
    • Avoid using any type
    • Use interface declarations for object shapes
  2. Naming Conventions

    • PascalCase for interfaces, types, and classes
    • camelCase for methods and variables
    • UPPER_CASE for constants
  3. File Organization

    • One class per file
    • Clear module boundaries
    • Consistent import ordering
  4. Documentation

    • JSDoc comments for public APIs
    • Clear inline comments for complex logic
    • Updated README for new features

Code Style

The project uses ESLint and Prettier for code formatting:

# Format code
pnpm run prettier

# Run linter
pnpm run lint

# Fix linting issues
pnpm run lint:fix

Testing

Running Tests

# Run all tests
pnpm test

# Run tests in watch mode
pnpm test:watch

# Run specific test file
pnpm test <path-to-test-file>

Writing Tests

  1. Unit Tests

    • Test individual components
    • Mock dependencies
    • Focus on behavior, not implementation
  2. Integration Tests

    • Test component interactions
    • Verify system workflows
    • Test error scenarios
  3. Test Coverage

    • Aim for high coverage
    • Cover edge cases
    • Include error scenarios

Documentation

  1. Code Documentation

    • Clear and concise comments
    • Updated JSDoc
    • TypeScript declarations
  2. Project Documentation

    • README.md updates
    • ARCHITECTURE.md for design changes
    • API documentation updates

Pull Request Process

  1. Before Creating a PR

    • Update documentation
    • Add/update tests
    • Run linter and tests
    • Rebase on latest main
  2. PR Guidelines

    • Clear description of changes
    • Reference related issues
    • Include test results
    • Add screenshots if applicable
  3. Review Process

    • Address review comments
    • Keep PR focused
    • Maintain clean commit history

Commit Messages

Follow the Conventional Commits specification:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style updates
  • refactor: Code refactoring
  • test: Test updates
  • chore: Maintenance tasks

Example:

feat(worker-pool): add dynamic scaling capability

- Implement automatic worker pool scaling
- Add configuration options
- Update documentation

Closes #123

Development Tips

Debugging

  1. Local Development
pnpm run debug
  1. Docker Development
# Build development image
pnpm run docker:build

# Run with development configuration
pnpm run docker:live:server

Common Issues

  1. Worker Thread Issues

    • Check resource limits
    • Verify message serialization
    • Monitor memory usage
  2. Performance Problems

    • Profile worker execution
    • Check task queue size
    • Monitor system resources
  3. Type Errors

    • Verify interface implementations
    • Check generic type constraints
    • Review type declarations

Getting Help

  • Check existing issues
  • Review documentation
  • Join development discussions
  • Ask questions in pull requests

License

By contributing, you agree that your contributions will be licensed under the project's MIT License.