# @pkg-tools/build

> A utility/tool for building packages

Latest version **1.0.2** (published 2024-03-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pkg-tools/build
pnpm add @pkg-tools/build
yarn add @pkg-tools/build
bun add @pkg-tools/build
```

Provides the command `build`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2024-03-02 |
| First published | 2023-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 38 |
| Maintainers | joemckenney |

## Links

- npm: https://www.npmjs.com/package/@pkg-tools/build
- Repository: https://github.com/pkg-tools/pkg-tools
- Issues: https://github.com/pkg-tools/pkg-tools/issues
- npm.io page: https://npm.io/package/@pkg-tools/build

## Dependencies (7)

- [defu](https://npm.io/package/defu.md) 6.1.3
- [citty](https://npm.io/package/citty.md) 0.1.5
- [consola](https://npm.io/package/consola.md) 3.2.3
- [nodemon](https://npm.io/package/nodemon.md) 3.0.2
- [unbuild](https://npm.io/package/unbuild.md) 2.0.0
- [@pkg-tools/utilities](https://npm.io/package/@pkg-tools/utilities.md) 1.0.1
- [@vanilla-extract/rollup-plugin](https://npm.io/package/@vanilla-extract/rollup-plugin.md) 1.3.0

## Recent versions

- 1.0.2 (latest) — 2024-03-02
- 1.0.1 — 2024-02-05
- 1.0.0 — 2024-02-05
- 0.2.0 — 2024-01-16
- 0.1.1 — 2024-01-08
- 0.1.0 — 2024-01-07
- 0.0.6 — 2024-01-05
- 0.0.5 — 2024-01-03
- 0.0.4 — 2024-01-01
- 0.0.3 — 2023-12-30
- 0.0.2 — 2023-12-29
- 0.0.1 — 2023-12-29

## README

# @pkg-tools/build

> A build tool with typed configuration.

[![@pkg-tools/build::version][build-version-src]][build-version-href] [![@pkg-tools/build::downloads][build-downloads-src]][build-downloads-href]

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

## Install

```bash
# 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.

```ts
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](./LICENSE)

[build-version-src]: https://img.shields.io/npm/v/%40pkg-tools/build?style=flat-square
[build-version-href]: https://npmjs.com/package/%40pkg-tools/build
[build-downloads-src]: https://img.shields.io/npm/dm/%40pkg-tools/build?style=flat-square
[build-downloads-href]: https://npmjs.com/package/%40pkg-tools/build

---
_Source: https://npm.io/package/@pkg-tools/build · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
