Postinstall Build Versions Save

Helper for conditionally building your npm package on postinstall

v5.0.3

5 years ago
  • Add missing LICENSE file. (#38, thanks @kylef!)

v5.0.2

5 years ago
  • Add deprecation notice. You should migrate onto npm 5.0.0 or greater and use the new prepare lifecycle script! postinstall-build's behavior is now officially part of npm.

v5.0.1

6 years ago

Changed

  • Fix detection of installation under node_modules (which is used to determine if the module is being installed as a dependency) when installing a scoped package (and possibly other scenarios). (#26 by @jlaramie)

v5.0.0

7 years ago

Added

  • Support for installing only the necessary build dependencies! #20
    • If your package.json contains a buildDependencies field, only those will be installed (instead of all devDependencies).
    • buildDependencies must be an array of package names that are found in devDependencies.
    • See the docs and examples.
  • New --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). #21
  • A warning is now printed if a potentially incompatible version of npm is detected. There are many broken versions of npm that do not work with postinstall-build 😢 – this should help explain why. #23

Changed

  • If postinstall 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.
  • Previously, if no build artifact was supplied, an exception was thrown. Now the error is logged and the process exits with status code 1. This should effectively be the same as before, but the exact behavior is consistent with the error handling in other steps.

v4.1.0

7 years ago

Added

  • A warning is now printed if the build artifact looks like npm … or yarn …. This is to prevent people from accidentally passing the build command where they should be providing the build artifact (which appears to happen regularly).

v4.0.0

7 years ago

Changes

  • 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.

v3.0.1

7 years ago

Improve documentation with more examples, including incorrect usage.

v3.0.0

7 years ago

Changed

  • 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.

Added

  • The 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.

v2.1.2

7 years ago

Changes

  • Switch from .npmignore blacklist to files whitelist.

v2.1.1

7 years ago

Added

  • Fancier documentation with a table of contents.