Skip to content


Repository files navigation


An opinionated TS package build toolchain w/ typed configuration.

Github Actions



# pnpm
pnpm add -D @pkg-tools/build @pkg-tools/clean @pkg-tools/config @pkg-tools/format @pkg-tools/lint

# yarn
yarn add -D @pkg-tools/build @pkg-tools/clean @pkg-tools/config @pkg-tools/format @pkg-tools/lint

# npm
npm install -D @pkg-tools/build @pkg-tools/clean @pkg-tools/config @pkg-tools/format @pkg-tools/lint

Use CLIs:

Use the CLIs provided by the packages in your package scripts.

"scripts": {
  "build": "build",
  "clean": "clean",
  "dev": "build -w",
  "format": "format",
  "lint": "lint"


Define a pkg.config.ts in the root of your package and configure your pkg-tools.

import { defineConfig } from "@pkg-tools/config";

export default defineConfig({
  build: {
    entries: ["src/index"],
    sourcemap: true,
    extensions: "compatible",
    rollup: {
      inlineDependencies: true,
      emitCJS: true,
      esbuild: {
        target: ["node16"],
        minify: true,
    declaration: "compatible",
  clean: {
    directory: "./dist",
  format: {
    semi: true,
    tabWidth: 2,
    singleQuote: true,
  lint: {
    rules: {
      "no-unused-vars": 0,

👀 Examples

Check out the examples to see pkg-tools usage.

🔬 Background

🚩 Problem

The build toolchain necessary to ship TS packages is complicated i.e., the dependencies, configuration, and package scripts necessary do the following.

  • build
  • dev (build w/ watch)
  • lint
  • format
  • clean

The complexity arises from the growing number of runtimes targeted, the variety of what might be in your package, and the volatility of the JS/TS ecosystem.


Create an opinionated TS package build toolchain to help accomplish the most common tasks. Each tool should do the following.

  • Wrap the modern best-of-breed tool for the task
  • Be usable as a CLI or programmatically
  • Be configurable via a single typed configuration file (pkg.config.ts)

🛠️ Tools

Below is the family of tools the comprise pkg-tools.

Package CLI(s) Library Status Version Downloads
@pkg-tools/build build unbuild 🟢 @pkg-tools/build::version @pkg-tools/build::downloads
@pkg-tools/clean clean shelljs 🟢 @pkg-tools/clean::version @pkg-tools/clean::downloads
@pkg-tools/format format prettier 🟢 @pkg-tools/format::version @pkg-tools/format::downloads
@pkg-tools/lint lint eslint 🟢 @pkg-tools/lint::version @pkg-tools/lint::downloads
@pkg-tools/sync sync oktokit 🟡 @pkg-tools/sync::version @pkg-tools/sync::downloads
@pkg-tools/sort sort oranize-imports / sort-package-json 🔴 @pkg-tools/sync::version @pkg-tools/sync::downloads


  • Clone this repository
  • Run fnm or nvm in the monorepo root
  • Install dependencies using pnpm install
  • Build the monorepo pnpm run build