Skip to content

Ensure that users of your package don't forget to run `npm install`.

License

Notifications You must be signed in to change notification settings

sorccu/please-update-dependencies

Repository files navigation

please-update-dependencies

npm

please-update-dependencies is a useful addition to Node.js CLI applications. It checks that currently installed dependencies satisfy the requirements set in your package.json, and won't let the user continue till they've updated the dependencies.

Example

Benefits/philosophy

Pros

  • Easy to understand error messages.
  • Encourages users to solve issues by themselves rather than overloading the maintainer with questions or issues.
  • No output when nothing's wrong.

Cons

  • If you release a botched update and forget to release a dependency that you've bumped up, users can't run your app.
  • Only semver compatible dependencies are checked.
    • If you use URLs as dependencies, they will simply be ignored.
  • Slight but mostly unnoticeable overhead.

Installation

Using yarn:

yarn add please-update-dependencies

Using npm:

npm install --save please-update-dependencies

Now, in your main file, before anything else, insert the following line:

require('please-update-dependencies')(module)

If you're using Babel or similar, you probably have an existing entry point. You should put the line there before activating babel or anything else.

If you don't put the line as the first thing in your file, you risk running into incompatibilities before any checks even run.

The dependency check will run every time the binary is invoked, unless you've exported ALLOW_OUTDATED_DEPENDENCIES=1. It'll find the nearest package.json (either in the same folder or a parent folder) and check things from there.

License

See LICENSE.

About

Ensure that users of your package don't forget to run `npm install`.

Resources

License

Stars

Watchers

Forks

Packages

No packages published