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 🙏

© 2021 – Pkg Stats / Ryan Hefner

npm-fetch-changelog

v2.2.1

Published

fetch the changelog for an npm package from GitHub

Downloads

35

Readme

npm-fetch-changelog

CircleCI Coverage Status semantic-release Commitizen friendly npm version

fetch the changelog for an npm package from GitHub

How it works

Right now only packages hosted on GitHub are supported. npm-fetch-changelog will get the package info and repository URL from npm, then try to fetch the GitHub release for each relevant version tag. If no GitHub release is found it will fall back to trying to parse the package's CHANGELOG.md or changelog.md. GitHub releases are way more reliable for this purpose though, so please use them!

Caveats

npm-fetch-changelog inevitably fails to find changelog entries for some packages/releases because many maintainers are not very detail-oriented about it (and don't choose to use excellent tools that would do the work for them, like semantic-release).

However, I've also seen cases where some versions were never published to npm (for instance, at the time of writing, superagent version 5.0.0 was never published to npm, yet it does have a changelog entry). npm-fetch-changelog currently only displays changelog entries for published versions.

API Tokens

GitHub heavily rate limits public API requests, but allows more throughput for authenticated requests. If you set the GH_TOKEN environment variable to a personal access token, npm-fetch-changelog will use it when requesting GitHub releases.

npm-fetch-changelog will also use the NPM_TOKEN environment variable or try to get the npm token from your ~/.npmrc, so that it can get information for private packages you request.

You can also store one or both of these tokesn in ~/.config/npm-fetch-changelog.json:

{
  "githubToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "npmToken": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

CLI

npm i -g npm-fetch-changelog
npm-fetch-changelog <package name>[@<range>]
what-broke <package name>[@<range>]

Prints changelog entries fetched from GitHub for each version released on npm in the given range.

what-broke is just a shortcut for npm-fetch-changelog --no-minor.

Options:

-r, --range

semver version range to get changelog entries for, e.g. ^7.0.0 (defaults to > the version installed in the working directory, if it exists)

You can also pass the range together with the package name (you might need to quote it):

npm-fetch-changelog '[email protected]>=2'

--json

output JSON instead of Markdown

--prereleases

include prerelease versions

--no-minor

exclude minor versions

--no-patch

exclude patch versions (defaults to --no-minor)

Node.js API

(the CLI just uses this under the hood)

import { fetchChangelog } from 'npm-fetch-changelog'
async function fetchChangelog(
  package: string,
  options?: {
    include?: ?(((version: string) => boolean) | {
      range?: ?string,
      prerelease?: ?boolean,
      minor?: ?boolean,
      patch?: ?boolean,
    }),
  }
): Promise<{[version: string]: {
  version: string,
  header: string,
  body?: string,
  date?: Date,
  error?: Error,
}}>