@pkg-tools/build
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@pkg-tools/build

A build tool with typed configuration.

@pkg-tools/build::version @pkg-tools/build::downloads

This tool is a thin abstraction on top of unbuild. It centralizes your build configuration, which helps us consistently build opensource packages that support both module systems (CJS and ESM).

Install

# w/ pnpm
pnpm add -D @pkg-tools/build @pkg-tools/config

# w/ yarn
yarn add -D @pkg-tools/build @pkg-tools/config

# w/ npm
npm install -D @pkg-tools/build @pkg-tools/config

Usage

In your package.json, you can use the exported cli build in your build script e.g.

"scripts": {
  "build": "build"
  "dev": "build -w"
  "stub": "build -s"
}

Configure

Define a pkg.config.ts in the root of your package and add the following.

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",
  },
});

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @pkg-tools/build

Weekly Downloads

47

Version

1.0.2

License

MIT

Unpacked Size

11.6 kB

Total Files

13

Last publish

Collaborators

  • joemckenney