# pkg-api

> API for pkg.

Latest version **1.0.0** (published 2020-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install pkg-api
pnpm add pkg-api
yarn add pkg-api
bun add pkg-api
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2020-08-21 |
| First published | 2020-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 4.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Richie Bendall |
| Maintainers | richienb |
| Keywords | pkg, build, api, cli, compile |

## Links

- npm: https://www.npmjs.com/package/pkg-api
- Repository: https://github.com/Richienb/pkg-api
- npm.io page: https://npm.io/package/pkg-api

## Dependencies (1)

- [dargs](https://npm.io/package/dargs.md) ^7.0.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2020-08-21

## README

# pkg-api [![Travis CI Build Status](https://img.shields.io/travis/com/Richienb/pkg-api/master.svg?style=for-the-badge)](https://travis-ci.com/Richienb/pkg-api)

API for [pkg](https://github.com/vercel/pkg).

[![NPM Badge](https://nodei.co/npm/pkg-api.png)](https://npmjs.com/package/pkg-api)

## Install

```sh
npm install pkg pkg-api
```

## Usage

```js
const pkg = require("pkg-api");

await pkg("index.js", {
	targets: "node10-win",
	output: "dist/output.exe"
});
```

## API

### pkg(input, options?)

#### input

Type: `string`

The entry file to build.

#### options

Type: `object`

##### build

Type: `boolean`\
Default: `false`

Whether to compile base binaries instead of downloading them.

##### debug

Type: `boolean`\
Default: `false`

Whether to log the packaging process.

##### config

Type: `string`\
Default: `package.json`

A `package.json` or any other json file containing the top-level config.

##### options

Type: `string`

A space-separated list of runtime options to pass to Node.js/V8.

##### output

Type: `string`

If only 1 executable is created, set its path.

##### outDir

The output directory to place the executables for multiple targets.

##### targets

A command-separated list of targets to build for.

## Related

- [pkg](https://github.com/vercel/pkg) - CLI used by this API.

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