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 ๐Ÿ™

ยฉ 2026 โ€“ย Pkg Stats / Ryan Hefner

pkg-bisect

v1.0.0

Published

๐Ÿ” Binary search tool to find which npm package version introduced a bug

Readme

pkg-bisect ๐Ÿ”

Binary search tool to find which npm package version introduced a bug.

The Problem

You know your tests passed with [email protected] but fail with [email protected]. Which exact version broke it? Manually testing each version is tedious.

The Solution

pkg-bisect uses binary search to efficiently find the first failing version:

pkg-bisect some-package 2.0.0 2.5.0 "npm test"

It will:

  1. Fetch all versions between 2.0.0 and 2.5.0 from npm registry
  2. Binary search through them
  3. Install each candidate version
  4. Run your test command
  5. Report the exact version where things broke

Installation

npm install -g pkg-bisect

Usage

pkg-bisect <package> <good-version> <bad-version> <test-command>

Example:

pkg-bisect react 18.2.0 18.3.1 "npm test"

Example with custom script:

pkg-bisect lodash 4.17.20 4.17.21 "node my-test.js"

How It Works

  1. Fetch versions from npm registry API
  2. Filter range between known good and bad versions
  3. Binary search:
    • Test middle version
    • If pass โ†’ bug is in newer half
    • If fail โ†’ bug is in older half or this one
    • Repeat until culprit found
  4. Report the first version where test fails

Efficiency: For 100 versions, checks only ~7 versions instead of all 100.

Requirements

  • Node.js 18+
  • npm/yarn in your project
  • A reproducible test command that exits with code 0 (pass) or non-zero (fail)

Example Output

๐ŸŽฏ Finding regression in some-package
   Good: 2.0.0
   Bad:  2.5.0
   Test: npm test

๐Ÿ“Š 12 versions to check

๐Ÿ” Bisecting 12 versions...

[0...6...11] Testing [email protected]
๐Ÿ“ฆ Installing [email protected]...
๐Ÿงช Running: npm test
โœ… Test passed

[7...9...11] Testing [email protected]
๐Ÿ“ฆ Installing [email protected]...
๐Ÿงช Running: npm test
โŒ Test failed

[7...8...8] Testing [email protected]
๐Ÿ“ฆ Installing [email protected]...
๐Ÿงช Running: npm test
โœ… Test passed

๐Ÿ› FOUND IT!
   [email protected] is the first broken version
   Previous version (2.4.0) was good

API

You can also use it programmatically:

import { pkgBisect } from 'pkg-bisect';

const culprit = await pkgBisect(
  'some-package',
  '2.0.0',
  '2.5.0',
  'npm test'
);

console.log(`Broken in: ${culprit}`);

License

MIT

Author

Polaroid (@prodigieux)


Built with ๐Ÿค– during a 3AM #buildinpublic session