@devicefarmer/please-update-dependencies
@devicefarmer/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.
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 @devicefarmer/please-update-dependencies
Using npm:
npm install --save @devicefarmer/please-update-dependencies
Now, in your main file, before anything else, insert the following line:
require('@devicefarmer/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.