Skip to content

Latest commit

 

History

History
209 lines (149 loc) · 3.62 KB

File metadata and controls

209 lines (149 loc) · 3.62 KB

Contributing to TSDX

Thanks for your interest in TSDX! Contributions are welcome.

If you're proposing a new feature, please open an issue first to discuss it.

Prerequisites

Installing Bun

# macOS/Linux
curl -fsSL https://bun.sh/install | bash

# Windows
powershell -c "irm bun.sh/install.ps1 | iex"

Setup

  1. Fork this repository to your own GitHub account and clone it:

    git clone https://github.com/your-username/tsdx.git
    cd tsdx
  2. Install dependencies:

    bun install
  3. Build the CLI:

    bun run build
  4. Link for local development:

    bun link

    Now you can use tsdx commands globally and they'll run your local version.

Development Workflow

Building

# Build once
bun run build

# Watch mode (rebuilds on changes)
bun run dev

Testing

# Run all tests
bun run test

# Watch mode
bun run test:watch

# Run specific test file
bun run test test/cli.test.ts

Linting

# Lint the codebase
bun run lint

# Auto-fix issues
bun run lint --fix

Type Checking

bun run typecheck

Formatting

# Format all files
bun run format

# Check formatting
bun run format:check

Testing Your Changes

Testing the CLI

After building, test your changes by creating a new project:

# Create a test project
cd /tmp
tsdx create test-project --template basic
cd test-project

# Verify it works
bun run build
bun run test

Testing Templates

Templates are in the templates/ directory. After modifying a template:

  1. Build tsdx: bun run build
  2. Create a new project: tsdx create test-project --template <template-name>
  3. Verify the generated project works correctly

Project Structure

tsdx/
├── src/
│   └── index.ts          # CLI entry point
├── templates/
│   ├── basic/            # Basic TypeScript template
│   └── react/            # React component template
├── test/
│   ├── cli.test.ts       # CLI unit tests
│   └── e2e.test.ts       # End-to-end tests
├── package.json
├── tsconfig.json
└── vitest.config.ts

Submitting a PR

  1. Create a feature branch:

    git checkout -b feature/my-feature
  2. Make your changes

  3. Run all checks:

    bun run lint
    bun run typecheck
    bun run test
    bun run build
  4. Commit your changes with a descriptive message:

    git commit -m "feat: add new feature"
  5. Push and create a pull request:

    git push origin feature/my-feature

Commit Message Guidelines

We follow Conventional Commits:

  • feat: - New features
  • fix: - Bug fixes
  • docs: - Documentation changes
  • test: - Test changes
  • refactor: - Code refactoring
  • chore: - Maintenance tasks

Adding a New Template

  1. Create a new directory in templates/:

    mkdir templates/my-template
  2. Add the template files (use basic as reference)

  3. Register the template in src/index.ts:

    const templates = {
      basic: { ... },
      react: { ... },
      'my-template': {
        name: 'my-template',
        description: 'Description of my template',
      },
    };
  4. Add tests for the new template

  5. Update the README to document the new template

Questions?

Feel free to open an issue if you have questions or need help.