Use npm-dependency-db
to list which npm packages depends on a given
version (or version range) of a given npm package.
A hosted web version of this module exists at: dependency.land.
npm install npm-dependency-db -g
If you are upgrading from versions older than v6.0.0, you need to
completely purge the cache by deleting the entire ~/.npm-dependency-db
directory and reimport everything by running npm-dependency-db --update
.
npm-dependency-db [<name> [range]] [options]
First time you use npm-dependency-db
you need to sync the npm
dependency tree to a local cache by running:
$ npm-dependency-db --update
Do this every time you want to get up-to-date with the latest changes from the npm database.
To perform a query, run:
$ npm-dependency-db <name> [range] [options]
Where <name>
is a name of the module you want to query and [range]
is an optional semver range similar to what you would write in a
package.json file.
E.g. to ask who depends on bluebird within the 2.x version range, you could run:
$ npm-dependency-db bluebird 2.x
E.g. to ask who depends on standard as a dev-dependency within the 7.x version range, you could run:
$ npm-dependency-db --dev standard 7
Run with --help
option to see a complete list of options.
var Updater = require('npm-dependency-db/updater')
var level = require('level')
var db = level('./test.db')
var updater = new Updater(db, {live: true})
updater.on('processed', function (n) {
console.log('processed npm change number %d', n)
})
Initialize the Updater
with a LevelDB compatible database and an
optional options
object.
The following options are supported:
key
- The hypercore key to create a feed from. Will default to a hard-coded keylive
- Iftrue
, the feed will be kept open while waiting for new changes. Ignored ifindexOnly
istrue
. Defaults tofalse
hypercorePath
- Path where to store the raw npm feed. Defaults to./npm-dependency-db.core
indexOnly
- Only build database index (do not download new blocks). Defaults tofalse
Emitted when updater.processed
, updater.startBlock
and
updater.currentBlock
have been populated.
Emitted when the updater.feed
is ready.
Emitted when a change object have been completely processed.
The first argument is the hypercore block number containing the change that have been processed.
Emitted when there is nothing more to process. Will not be emitted if
options.live
is true
unless an error occurs.
Emitted if an error occurs.
The first arguemnt is the error.
A hypercore feed. Contains all npm change objects. Each change is a block in the feed.
The change (i.e. hypercore block number) where the feed will start to
process in this instance of the Updater
.
The change (i.e. hypercore block number) that is currently beeing processed.
The number of changes processed so far in the feed.
MIT