Contributing - rahulpandita/react-term GitHub Wiki

react-term is a pnpm monorepo. All packages live under packages/ and share a single node_modules tree.

Setup

git clone https://github.com/rahulpandita/react-term.git
cd react-term
pnpm install

Workspace Structure

Directory Package Description
packages/core @next_term/core Cell grid, VT parser, buffer management, Unicode utilities
packages/web @next_term/web WebTerminal, renderers, workers, addons
packages/react @next_term/react React components
packages/native @next_term/native React Native components
packages/demo Development demo app

Common Commands

pnpm test           # Run all tests with Vitest
pnpm test:watch     # Watch mode
pnpm dev            # Start the demo app
pnpm build          # Build all packages
pnpm lint           # Biome lint check
pnpm lint:fix       # Auto-fix lint issues
pnpm typecheck      # tsc --noEmit across all packages
pnpm bench          # Run benchmarks

Tests

Tests live alongside source files as *.test.ts in packages/*/src/__tests__/. Vitest is configured to include all packages/*/src/**/*.test.ts files.

Path aliases:

  • @next_term/corepackages/core/src/index.ts
  • @next_term/webpackages/web/src/index.ts

To add tests, create a *.test.ts file in the appropriate __tests__/ directory and import via the package alias (e.g., import { wcwidth } from '@next_term/core').

Code Style

Formatting and linting are enforced by [Biome]((biomejs.dev/redacted), configured in biome.json. Biome runs automatically on staged files via lint-staged.

  • TypeScript strict mode; all public APIs must be typed.
  • Comments only where the code is non-obvious.
  • Performance-sensitive paths (parser, renderers) should include benchmark verification before and after changes (see the bench script).
  • Tests should cover edge cases explicitly — see wcwidth.test.ts and parser-edge-cases.test.ts for examples.