🍺 dev only postinstall hook
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.eslintrc.js Fix missing shebgang and add engines field Jun 12, 2018
.gitignore first commit Jun 8, 2018
.travis.yml first commit Jun 8, 2018
LICENSE first commit Jun 8, 2018
README.md Update README.md Oct 21, 2018
bin.js Fix missing shebgang and add engines field Jun 12, 2018
index.js Add install alias and --silent Jun 11, 2018
package-lock.json 1.1.1 Jun 12, 2018
package.json Update package.json Nov 5, 2018
test.js Add install alias and --silent Jun 11, 2018


pinst Build Status npm

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.

Alternatively, you can also use it the other way around and prevent postinstall hook to run in dev (that's how I'm using it for husky).


$ npm install pinst --save-dev
// package.json
  "scripts": {
    "postinstall": "...",
    // Add pinst to npm publish hooks
    "prepublishOnly": "pinst --disable",
    "postpublish": "pinst --enable"
$ npm publish

On prepublishOnly, postinstall will be renamed to _postinstall (disabled)

On postpublish, it will be renamed back to postinstall (enabled)


pinst accepts the following flags

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

Try it

You can test that everything works, without actually publishing your package, by manually running the following commands

npm run prepublishOnly # Check package.json
npm run postpublish    # Check package.json


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

pinst also supports install alias.


MIT - Typicode 🌵 - Patreon