Skip to content

TSDX

Zero-config CLI for building, testing, and publishing TypeScript libraries.

Stars
11.5k
Forks
491
Licence
MIT
Language
TypeScript
Last update
9 months ago
Type
Dev tool

What it is

TSDX is a command-line tool that sets up and runs the common steps of building a TypeScript library: creating a project from a template, building it into ESM and CommonJS output with type declarations, running tests, linting, and formatting. It aims to work with sensible defaults so you do not have to write much configuration. The README says version 2.0 is a rewrite built on newer tools such as bunchee, vitest, oxlint, and oxfmt, and it uses Bun for package management.

  • Create a new TypeScript library from the basic or react template with bunx tsdx create
  • Build a package that outputs ESM, CommonJS, and .d.ts files with tsdx build
  • Run tests with vitest, including watch mode and coverage, using tsdx test
  • Lint and format a codebase with tsdx lint and tsdx format

Great for

  • Developers who want to publish a reusable TypeScript library to npm without writing build configuration
  • Teams starting a new React component library that want a ready-made template with Testing Library
  • Developers already using Bun who want a single tool for building and testing packages
  • Maintainers upgrading a v0.x TSDX project who can follow the migration guide

Not ideal for

  • People building full applications or websites rather than libraries, since the tool is aimed at package development
  • Projects that require Node.js older than 20 or cannot use Bun, because the README lists these as requirements
  • Teams that need the original Jest and ESLint setup from TSDX v0.x without migrating, since v2.0 replaces those tools
Step-by-step guide: how to use TSDXInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Node.js 20+ · Bun (latest)

    Global install (for creating projects)

    bun add -g tsdx

    Per-project install

    bun add -D tsdx
  2. 2

    Run it

    • Run bunx tsdx create mylib to generate a project
    • Change into the new mylib directory
    • Run bun run dev to start development mode
    • Edit src/index.ts and build with tsdx build
  3. 3

    Get the most out of it

    • Use the react template for a React component library with a Vite-powered example app
    • Add a .oxlintrc.json file to customize lint rules
    • Add a .oxfmtrc.json file to change formatting options such as line width
    • Use tsdx typecheck --watch to catch type errors while editing
    • Follow the migration guide if moving an existing v0.x project

Downloads

Strengths

  • Sensible defaults mean a new library can start with a single command
  • Generates dual ESM and CommonJS output with exports configured automatically
  • Covers build, test, lint, format, and typecheck in one CLI

Trade-offs

  • Version 2.0 is a rewrite, so v0.x projects need changes to their tooling and scripts
  • Requires Bun for package management, which adds a dependency beyond Node.js
  • The README's speed claims are not independently verified here

How it compares

ProjectStarsTypeLevelUpdatedBest for
tsdx (this)11.5kDev toolbeginner9 months agoDevelopers who want to publish a reusable TypeScript library to npm without writing build configuration
tsup11.3kDev toolbeginner5 days agoDevelopers who maintain a TypeScript library and want a simple build step
js-stack-from-scratch20.1kLearning resourceintermediate2.4 years agoDevelopers who already know JavaScript basics and want to understand how a React and Node setup is put together
verdaccio18kAppbeginner4 days agoTeams that want to share private npm packages inside a company
pnpm37kDev toolbeginner4 days agoDevelopers working in Node.js projects who want faster installs and less disk use
react-scan21.9kDev toolbeginner3 months agoDevelopers debugging slow React pages in development

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.