1- # what-broke
1+ # npm-fetch-changelog
22
3- [ ![ CircleCI] ( https://circleci.com/gh/jedwards1211/what-broke .svg?style=svg )] ( https://circleci.com/gh/jedwards1211/what-broke )
4- [ ![ Coverage Status] ( https://codecov.io/gh/jedwards1211/what-broke /branch/master/graph/badge.svg )] ( https://codecov.io/gh/jedwards1211/what-broke )
3+ [ ![ CircleCI] ( https://circleci.com/gh/jedwards1211/npm-fetch-changelog .svg?style=svg )] ( https://circleci.com/gh/jedwards1211/npm-fetch-changelog )
4+ [ ![ Coverage Status] ( https://codecov.io/gh/jedwards1211/npm-fetch-changelog /branch/master/graph/badge.svg )] ( https://codecov.io/gh/jedwards1211/npm-fetch-changelog )
55[ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release )
66[ ![ Commitizen friendly] ( https://img.shields.io/badge/commitizen-friendly-brightgreen.svg )] ( http://commitizen.github.io/cz-cli/ )
7- [ ![ npm version] ( https://badge.fury.io/js/what-broke .svg )] ( https://badge.fury.io/js/what-broke )
7+ [ ![ npm version] ( https://badge.fury.io/js/npm-fetch-changelog .svg )] ( https://badge.fury.io/js/npm-fetch-changelog )
88
9- list breaking changes in newer major versions of packages
9+ fetch the changelog for an npm package from GitHub
1010
1111# How it works
1212
13- Right now only packages hosted on GitHub are supported. ` what-broke ` will get
13+ Right now only packages hosted on GitHub are supported. ` npm-fetch-changelog ` will get
1414the package info and repository URL from ` npm ` , then try to fetch the GitHub
1515release for each relevant version tag. If no GitHub release is found it will
1616fall back to trying to parse the package's ` CHANGELOG.md ` or ` changelog.md ` .
@@ -19,34 +19,34 @@ them!
1919
2020# Caveats
2121
22- ` what-broke ` inevitably fails to find changelog entries for some packages/releases
22+ ` npm-fetch-changelog ` inevitably fails to find changelog entries for some packages/releases
2323because many maintainers are not very detail-oriented about it (and don't choose
2424to use excellent tools that would do the work for them, like
2525[ ` semantic-release ` ] ( https://github.com/semantic-release/semantic-release ) ).
2626
2727However, I've also seen cases where some versions were never published to npm
2828(for instance, at the time of writing, ` superagent ` version 5.0.0 was never
29- published to npm, yet it does have a changelog entry). ` what-broke ` currently
29+ published to npm, yet it does have a changelog entry). ` npm-fetch-changelog ` currently
3030only displays changelog entries for published versions.
3131
3232# API Tokens
3333
3434GitHub heavily rate limits public API requests, but allows more throughput for
3535authenticated requests. If you set the ` GH_TOKEN ` environment variable to a
36- personal access token, ` what-broke ` will use it when requesting GitHub releases.
36+ personal access token, ` npm-fetch-changelog ` will use it when requesting GitHub releases.
3737
38- ` what-broke ` will also use the ` NPM_TOKEN ` environment variable or try to get
38+ ` npm-fetch-changelog ` will also use the ` NPM_TOKEN ` environment variable or try to get
3939the npm token from your ` ~/.npmrc ` , so that it can get information for private
4040packages you request.
4141
4242# CLI
4343
4444```
45- npm i -g what-broke
45+ npm i -g npm-fetch-changelog
4646```
4747
4848```
49- what-broke <package name>
49+ npm-fetch-changelog <package name>
5050```
5151
5252Prints changelog entries fetched from GitHub for each
@@ -58,6 +58,10 @@ version released on npm in the given range.
5858
5959semver version range to get changelog entries for, e.g. ` ^7.0.0 ` (defaults to ` > ` the version installed in the working directory, if it exists)
6060
61+ ### ` --json `
62+
63+ output JSON instead of Markdown
64+
6165### ` --prereleases `
6266
6367include prerelease versions
@@ -75,11 +79,11 @@ exclude patch versions (defaults to `--no-minor`)
7579(the CLI just uses this under the hood)
7680
7781``` js
78- import whatBroke from ' what-broke '
82+ import { fetchChangelog } from ' npm-fetch-changelog '
7983```
8084
8185``` js
82- async function whatBroke (
86+ async function fetchChangelog (
8387 package : string ,
8488 options ?: {
8589 include?: ? (((version : string ) => boolean) | {
@@ -89,5 +93,11 @@ async function whatBroke(
8993 patch?: ? boolean,
9094 }),
9195 }
92- ): Promise < Array < {version: string, body: string}>>
96+ ): Promise < {[version: string]: {
97+ version: string,
98+ header: string,
99+ body?: string,
100+ date?: Date ,
101+ error?: Error ,
102+ }}>
93103` ` `
0 commit comments