Enable or disable npm preinstall and postinstall hook
npm install @phiberber/pinstpinst lets you have the preinstall and postinstall hooks running only in dev 🍺
prepare hook instead. pinst is mainly useful for Yarn 2+ since it doesn't support prepare hook. See https://yarnpkg.com/advanced/lifecycle-scripts
js
// package.json
{
"scripts": {
"preinstall": "",
"postinstall": "",
"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.