Enable or disable npm postinstall hook
npm install @ozum/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.
``sh`
$ npm install pinst --save-dev
`js`
// package.json
{
"scripts": {
"postinstall": "
"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)_
pinst accepts the following flags:
``
--enable, -e Enable postinstall hook
--disable, -d Disable postinstall hook
--silent, -s
To test that everything works without actually publishing your package, you can manually run the following commands:
`sh`
$ npm run prepublishOnly
$ npm run postpublish
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 :cactus: