# @ozum/pinst

> Enable or disable npm postinstall hook

Latest version **2.1.4** (published 2021-02-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ozum/pinst
pnpm add @ozum/pinst
yarn add @ozum/pinst
bun add @ozum/pinst
```

Provides the command `pinst`.

## 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 | 2.1.4 |
| Published | 2021-02-01 |
| First published | 2021-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 2 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 263 |
| Author | typicode |
| Maintainers | ozum |
| Keywords | npm, postinstall, lifecycle, dev, devpostinstall |

## Links

- npm: https://www.npmjs.com/package/@ozum/pinst
- Repository: https://github.com/typicode/pinst
- Homepage: https://github.com/typicode/pinst#readme
- Issues: https://github.com/typicode/pinst/issues
- npm.io page: https://npm.io/package/@ozum/pinst

## Dependencies (2)

- [fromentries](https://npm.io/package/fromentries.md) ^1.3.2
- [write-json-file](https://npm.io/package/write-json-file.md) ^4.3.0

## Recent versions

- 2.1.4 (latest) — 2021-02-01

## README

# pinst ![Node.js CI](https://github.com/typicode/pinst/workflows/Node.js%20CI/badge.svg) [![npm](https://img.shields.io/npm/v/pinst.svg)](https://www.npmjs.com/package/pinst)

> `pinst` lets you have `postinstall` hook that runs only in dev 🍺

This can be useful if you want to automatically run commands just after `npm install`, but don't want your package users to be affected.

## Usage

```sh
$ npm install pinst --save-dev
```

```js
// package.json
{
  "scripts": {
    "postinstall": "<some dev only command>",
    "prepublishOnly": "pinst --disable",
    "postpublish": "pinst --enable"
  }
}
```

```sh
$ npm publish
```

_On `prepublishOnly`, `postinstall` will be renamed to `_postinstall` (disabled)_

_On `postpublish`, it will be renamed back to `postinstall` (enabled)_

## CLI

`pinst` accepts the following flags:

```
--enable, -e   Enable postinstall hook
--disable, -d  Disable postinstall hook
--silent, -s
```

## Try it

To test that everything works without actually publishing your package, you can manually run the following commands:

```sh
$ npm run prepublishOnly
$ npm run postpublish
```

## Tips

By inverting commands, you can also use `pinst` to enable `postinstall` for your users only and not yourself.

`pinst` also supports `install` alias.

## License

MIT - [Typicode :cactus:](https://github.com/typicode)

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