# @phiberber/pinst

> Enable or disable npm preinstall and postinstall hook

Latest version **3.0.1** (published 2022-11-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @phiberber/pinst
pnpm add @phiberber/pinst
yarn add @phiberber/pinst
bun add @phiberber/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 | 3.0.1 |
| Published | 2022-11-25 |
| First published | 2022-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Author | typicode |
| Maintainers | phiberber |
| Keywords | npm, postinstall, lifecycle, dev, devpostinstall |

## Links

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

## Recent versions

- 3.0.1 (latest) — 2022-11-25

## README

# pinst [![Node.js CI](https://github.com/typicode/pinst/workflows/Node.js%20CI/badge.svg)](https://github.com/typicode/pinst/actions) [![npm](https://img.shields.io/npm/v/pinst.svg)](https://www.npmjs.com/package/pinst)

> `pinst` lets you have the `preinstall` and `postinstall` hooks running only in dev 🍺

__Important__ if your project is using npm or pnpm, you can achieve the desired effect by setting a `prepare` hook instead. `pinst` is mainly useful for Yarn 2+ since it doesn't support `prepare` hook. See https://yarnpkg.com/advanced/lifecycle-scripts

## Usage

```js
// package.json
{
  "scripts": {
    "preinstall": "<some dev only command>",
    "postinstall": "<some dev only command>",
    "prepack": "pinst --disable",
    "postpack": "pinst --enable"
  }
}
```

_On `prepack`, `preinstall` and `postinstall` will be renamed to `_preinstall` and `_postinstall` (disabled)_

_On `postpack`, it will be renamed back to `preinstall` and `postinstall` (enabled)_

## CLI

`pinst` accepts the following flags:

```
--enable, -e   Enable preinstall & postinstall hook
--disable, -d  Disable preinstall & postinstall hook
--silent, -s
```

## Tips

By inverting commands, you can also use `pinst` to enable `preinstall` or `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/@phiberber/pinst · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
