Thank you for your interest in contributing to dr-manhattan!
- Node.js >= 20.0.0
- pnpm >= 9.0.0
# Clone the repository
git clone https://github.com/gtg7784/dr-manhattan-ts.git
cd dr-manhattan-ts
# Install dependencies
pnpm install
# Run tests
pnpm test
# Build
pnpm build| Command | Description |
|---|---|
pnpm dev |
Watch mode build |
pnpm build |
Production build |
pnpm test |
Run tests in watch mode |
pnpm test:run |
Run tests once |
pnpm lint |
Check linting |
pnpm lint:fix |
Fix linting issues |
pnpm format |
Format code |
pnpm typecheck |
Type check |
This project uses Biome for linting and formatting.
- Indentation: 2 spaces
- Quotes: Single quotes
- Semicolons: Always
- Trailing commas: ES5 style
- Line width: 100 characters
Run pnpm lint:fix before committing to auto-fix issues.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Ensure all checks pass:
pnpm lint pnpm typecheck pnpm test:run pnpm build
- Commit your changes with a descriptive message
- Push to your fork and open a Pull Request
Use clear, descriptive commit messages:
feat: add support for new exchangefix: resolve orderbook sync issuedocs: update API referencerefactor: simplify market utilstest: add tests for position utils
-
Create a new directory under
src/exchanges/<exchange-name>/ -
Implement the
Exchangeabstract class:
// src/exchanges/<exchange-name>/index.ts
import { Exchange, type ExchangeConfig, type Market } from '../../core/exchange';
export class NewExchange extends Exchange {
readonly id = 'newexchange';
readonly name = 'New Exchange';
async fetchMarkets(params?: FetchMarketsParams): Promise<Market[]> {
// Implementation
}
async fetchMarket(marketId: string): Promise<Market> {
// Implementation
}
// Implement other abstract methods...
}-
Export from
src/exchanges/index.ts -
Add to
EXCHANGESmap insrc/exchanges/index.ts -
Add tests in
tests/ -
Update README.md with the new exchange
Tests are written using Vitest.
import { describe, it, expect } from 'vitest';
describe('NewExchange', () => {
it('should fetch markets', async () => {
// #given
const exchange = new NewExchange();
// #when
const markets = await exchange.fetchMarkets();
// #then
expect(markets).toBeDefined();
expect(Array.isArray(markets)).toBe(true);
});
});Use #given, #when, #then comments to structure tests clearly.
When opening an issue, please include:
- Node.js version (
node --version) - pnpm version (
pnpm --version) - Reproduction steps
- Expected vs actual behavior
- Error messages (if any)
By contributing, you agree that your contributions will be licensed under the MIT License.