Helper for conditionally building your npm package on postinstall
prepare
lifecycle script! postinstall-build's behavior is now officially part of npm.--verbose
option. When enabled, postinstall-build
will print informational messages about what it is doing (and why) at each step. Overrides the --silent
option (the last one specified wins). #21postinstall-build
😢 – this should help explain why. #23postinstall
was triggered from npm install
(no args) being run in the package itself, and we expect it to have already installed devDependencies
, then the installation step will be skipped completely. Previously, npm install --only=dev
was run, which should have been a no-op anyway.package.json:bin
now points to a different file than package.json:main
. This means that doing require('postinstall-build')
, while never officially supported, no longer runs the postinstall-build
script (instead, it exports the function that runs it). This is to protect against misbehaving dependencies that may import modules they happen to find under node_modules
and expect there to be no side effects. See #18.Improve documentation with more examples, including incorrect usage.
In some cases, npm itself can end up being installed somewhere in your dependency tree (for example, older versions of ember-cli
install it), resulting in its npm
script shadowing the version you‘re actually using. This means any npm run …
or npm install …
you have in your lifecycle scripts (like those from postinstall-build
) may end up running an unexpected, incompatible version of npm.
To solve this, postinstall-build
will now execute $npm_execpath
instead of just npm
when the user agent is npm. (If your build command starts with npm run …
and you want to fix that, too, you can use the --script
option, and postinstall-build
will make sure to use the correct npm
reference for you.)
This is technically backwards incompatible, but should only be breaking in extremely rare cases that were questionable to begin with.
postinstall-build
script accepts a new flag --only-as-dependency
. When present, it will skip building when you do an npm install
in the package‘s own directory (for development). The build will only occur if the package is being installed as a dependency (and the specified build artifact is missing). Fixes #13.