npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

npm-dependency-db

v6.0.8

Published

Query npm dependents of a certain version or version range of a given package

Downloads

12

Readme

npm-dependency-db

Use npm-dependency-db to list which npm packages depends on a given version (or version range) of a given npm package.

Build status js-standard-style

A hosted web version of this module exists at: dependency.land.

Installation

npm install npm-dependency-db -g

Upgrading from previous versions

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.

CLI Usage

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.

Programmatic Usage

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)
})

API

Updater(db[, options])

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 key
  • live - If true, the feed will be kept open while waiting for new changes. Ignored if indexOnly is true. Defaults to false
  • 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 to false

Event: init

Emitted when updater.processed, updater.startBlock and updater.currentBlock have been populated.

Event: running

Emitted when the updater.feed is ready.

Event: processed

Emitted when a change object have been completely processed.

The first argument is the hypercore block number containing the change that have been processed.

Event: end

Emitted when there is nothing more to process. Will not be emitted if options.live is true unless an error occurs.

Event: error

Emitted if an error occurs.

The first arguemnt is the error.

updater.feed

A hypercore feed. Contains all npm change objects. Each change is a block in the feed.

updater.startBlock

The change (i.e. hypercore block number) where the feed will start to process in this instance of the Updater.

updater.currentBlock

The change (i.e. hypercore block number) that is currently beeing processed.

updater.processed

The number of changes processed so far in the feed.

License

MIT