When developing npm packages, (projects with
package.json at the root), it is common to specify extra setup steps needed to begin development. Specifically, it is common to see a readme like this:
Install dependencies and setup development environment
npm install ./setup-dev-env.sh
It would be awesome to have a “postinstall” script that only runs when
npm install is run without arguments. Then the above could simply be:
Unfortunately, you can’t use
postinstall (on published packages) because then the script is run when the package is included as a dependency.
Fortunately, this is exactly what the
prepare script does if you can deal with the fact that it also runs before publishing. Regardless, I think a new script is warranted.
postinstallOnly” might be an apt name…