Contributing to the TypeScript SDK

This guide will help you get started with contributing to the Opik TypeScript SDK.

Before you start, please review our general Contribution Overview and the Contributor License Agreement (CLA).

Project Structure

The TypeScript SDK is located in the sdks/typescript directory. Here’s an overview of the key files and directories:

  • src/: Contains the main source code
  • tests/: Contains test files
  • examples/: Contains example usage of the SDK
  • package.json: Project dependencies and scripts
  • tsconfig.json: TypeScript configuration
  • tsup.config.ts: Build configuration
  • vitest.config.ts: Test configuration

Setup

1

Install dependencies

bash cd sdks/typescript npm install
2

Build the SDK

bash npm run build
3

Run tests

bash npm test

Development Workflow

1

Create a new branch

Create a new branch for your changes
2

Make your changes

Implement your changes
3

Add tests

Add tests for new functionality
4

Run test suite

Run the test suite to ensure everything works
5

Build the SDK

Build the SDK to ensure it compiles correctly
6

Submit PR

Submit a pull request

Testing

We use Vitest for testing. Tests are located in the tests/ directory. When adding new features:

1

Write unit tests

Write unit tests for your changes
2

Run tests

Ensure all tests pass with npm test
3

Check coverage

Maintain or improve test coverage

Building

The SDK is built using tsup. To build:

$npm run build

This will create the distribution files in the dist/ directory.

Documentation

When adding new features or making changes:

1

Update README

Update the README.md if necessary
2

Add JSDoc

Add JSDoc comments for new functions and classes
3

Add examples

Include examples in the examples/ directory
4

Update docs

Update the main documentation if necessary. See the Documentation Guide for details.

Code Style

We use ESLint for code style enforcement. The configuration is in eslint.config.js. Before submitting a PR:

1

Run linter

Run npm run lint to check for style issues
2

Fix issues

Fix any linting errors
3

Check style

Ensure your code follows the project’s style guidelines

Pull Request Process

1

Fork repository

Fork the repository
2

Create branch

Create your feature branch
3

Make changes

Make your changes
4

Run checks

Run tests and linting
5

Submit PR

Submit a pull request

Your PR should:

  • Have a clear description of the changes
  • Include tests for new functionality
  • Pass all CI checks
  • Follow the project’s coding standards

Need Help?

If you need help or have questions:

  • Open an issue on GitHub
  • Join our Comet Chat community
  • Check the existing documentation

Remember to review our Contributor License Agreement (CLA) before contributing.