Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@phiberber/pinst

phiberber7MIT3.0.1

Enable or disable npm preinstall and postinstall hook

npm, postinstall, lifecycle, dev, devpostinstall

readme

pinst Node.js CI npm

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

// 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 `preinstallandpostinstall` (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: