UNPKG

1.16 kBMarkdownView Raw
1# @pika/plugin-simple-bin
2
3> A [@pika/pack](https://github.com/pikapkg/pack) build plugin.
4> Adds a simple CLI wrapper to your package and properly configures your package.json `"bin"` field to point to it. Useful for quickly adding a command line interface to your library.
5
6
7## Install
8
9```sh
10# npm:
11npm install @pika/plugin-simple-bin --save-dev
12# yarn:
13yarn add @pika/plugin-simple-bin --dev
14```
15
16
17## Usage
18
19```json
20{
21 "name": "example-package-json",
22 "version": "1.0.0",
23 "@pika/pack": {
24 "pipeline": [
25 ["@pika/plugin-standard-pkg"],
26 ["@pika/plugin-build-node"],
27 ["@pika/plugin-simple-bin", {"bin": "my-cli"}]
28 ]
29 }
30}
31```
32
33For more information about @pika/pack & help getting started, [check out the main project repo](https://github.com/pikapkg/pack).
34
35
36## Result
37
381. Adds a simple bin/CLI wrapper to your built package: `dist-node/index.bin.js`
39 1. Built for Node.js
40 1. Loads your library, and calls an exported `run()` method with the CLI args.
41 1. Will load a bundled Node.js distribution if one exists.
421. Configures the built package.json with a new `"bin"` entrypoint, so that npm knows to install your package as a CLI.
\No newline at end of file