explaingit

jaredpalmer/tsdx

11,465TypeScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line tool that sets up and builds TypeScript packages for npm publishing, handling bundling, testing, linting, and formatting automatically so you can start writing code right away.

Mindmap

mindmap
  root((tsdx))
    What it does
      Scaffolds TS packages
      Handles bundling
      Configures tests
      Formats and lints
    Tech Stack
      TypeScript
      Bun runtime
      SWC and Rollup
      Vitest and oxlint
    Use Cases
      npm library setup
      React component lib
      Zero-config builds
    Output
      ESM format
      CommonJS format
      Type declarations
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Scaffold a new TypeScript library with a single command, getting bundling, tests, and linting pre-configured.

USE CASE 2

Build and publish a React component library to npm with ESM and CommonJS output and TypeScript declarations included.

USE CASE 3

Replace manual Rollup, Jest, and ESLint configuration with a zero-config build tool that produces production-ready npm packages.

Tech stack

TypeScriptBunRollupSWCVitestoxlint

Getting it running

Difficulty · easy Time to first run · 5min

Requires Node.js 20 or newer and Bun installed on the machine.

In plain English

TSDX is a command-line tool that handles the setup and build process for TypeScript packages that you want to publish to npm. The idea is that starting a new TypeScript library involves a lot of boilerplate: configuring a bundler, setting up tests, deciding on code formatting and linting rules, and making sure the package output works for both modern and older JavaScript environments. TSDX does all of that for you so you can start writing code immediately. Version 2.0 is a rewrite that swaps out the original tooling for faster alternatives. Bundling is handled by bunchee, which is built on top of Rollup and SWC. Testing uses vitest instead of Jest. Linting uses oxlint, described in the README as 50 to 100 times faster than ESLint. Formatting uses oxfmt. Package management relies on Bun. These are all Rust-based or Bun-native tools chosen for speed. When you create a new project with TSDX, it generates a standard folder structure with source files in src/, tests in test/, and build output in dist/. The build command produces two output formats automatically: ESM for modern bundlers and module-aware Node.js, and CommonJS for older environments. TypeScript declaration files are included in the output as well, so consumers of your library get type information without extra steps. The package.json exports field is configured automatically to point to the right file for each use case. Two project templates are available: a basic TypeScript library and a React component library. The React template includes a small demo application powered by Vite so you can develop and preview the component locally. Requirements are Node.js 20 or newer and Bun installed. People upgrading from the original version of TSDX need to follow a migration guide, since the tooling changed significantly between v0.x and v2.0.

Copy-paste prompts

Prompt 1
I'm using tsdx to build a TypeScript library. Show me how to create a new project, add an exported function, build it, and verify the ESM and CJS outputs are correct.
Prompt 2
Help me migrate my existing TypeScript npm package from tsdx v0.x to tsdx v2.0, covering the changes from Jest to vitest and from ESLint to oxlint.
Prompt 3
I'm using the tsdx React template. Show me how to set up a React component library with a local Vite-powered demo app for development preview.
Prompt 4
Explain how tsdx automatically configures the package.json exports field to route ESM and CommonJS consumers to the correct output file.
Open on GitHub → Explain another repo

← jaredpalmer on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.