Skip to content

Latest commit

 

History

History
122 lines (88 loc) · 2.28 KB

File metadata and controls

122 lines (88 loc) · 2.28 KB

Contributing

🚀 Getting Started

Prerequisites

Development Setup

  1. Install dependencies

    npm install
  2. Build the project

    npm run build
  3. Run tests

    npm test

    npm test assumes the native addon is already built. If you changed Rust code (or need a fresh addon), run:

    npm run test:build

🔧 Making Changes

Branch Naming

Use descriptive branch names:

  • feat/add-websocket-support - for new features
  • fix/memory-leak-in-request - for bug fixes
  • docs/update-readme - for documentation
  • refactor/optimize-loader - for refactoring
  • test/add-integration-tests - for tests

Code Style

Use Biome for formatting and linting:

# Check formatting and linting
npm run check

# Auto-fix formatting and linting issues
npm run check:fix

📝 Commit Message Guidelines

Follow Conventional Commits:

Types

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • refactor: Code refactoring
  • perf: Performance improvements
  • test: Adding or updating tests
  • ci: CI configuration changes
  • chore: Other changes that don't modify src or test files

Examples

# Feature
feat(request): add support for HTTP/3

# Bug fix
fix(loader): resolve platform detection on Alpine Linux

# Documentation
docs(readme): add installation instructions for pnpm

# Breaking change
feat(api)!: change request signature to accept options object

BREAKING CHANGE: request() now requires an options object instead of positional arguments

🧪 Testing

Writing Tests

  • Write tests for all new features
  • Update tests when fixing bugs
  • Use descriptive test names
// Good
test('should load correct binary for macOS ARM64', () => {
  // ...
});

// Bad
test('test1', () => {
  // ...
});

Running Tests

# Run all tests (without rebuilding native addon)
npm test

# Build native addon + run all tests
npm run test:build

# Run specific test file
npm test -- path/to/test.spec.ts

🙏 Thank You!

Your contributions make this project better for everyone. Thank you for taking the time to contribute! 🚀