From bc8da3575c99ab4b65c0deaec459ca1645aba320 Mon Sep 17 00:00:00 2001 From: Andy Edwards Date: Tue, 7 May 2019 01:22:20 -0500 Subject: [PATCH] fix: rename to npm-fetch-changelog --- README.md | 40 +++++++++++++++++++++++++--------------- package.json | 10 +++++----- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 04c530d..88fa58e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ -# what-broke +# npm-fetch-changelog -[![CircleCI](https://circleci.com/gh/jedwards1211/what-broke.svg?style=svg)](https://circleci.com/gh/jedwards1211/what-broke) -[![Coverage Status](https://codecov.io/gh/jedwards1211/what-broke/branch/master/graph/badge.svg)](https://codecov.io/gh/jedwards1211/what-broke) +[![CircleCI](https://circleci.com/gh/jedwards1211/npm-fetch-changelog.svg?style=svg)](https://circleci.com/gh/jedwards1211/npm-fetch-changelog) +[![Coverage Status](https://codecov.io/gh/jedwards1211/npm-fetch-changelog/branch/master/graph/badge.svg)](https://codecov.io/gh/jedwards1211/npm-fetch-changelog) [![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) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -[![npm version](https://badge.fury.io/js/what-broke.svg)](https://badge.fury.io/js/what-broke) +[![npm version](https://badge.fury.io/js/npm-fetch-changelog.svg)](https://badge.fury.io/js/npm-fetch-changelog) -list breaking changes in newer major versions of packages +fetch the changelog for an npm package from GitHub # How it works -Right now only packages hosted on GitHub are supported. `what-broke` will get +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`. @@ -19,34 +19,34 @@ them! # Caveats -`what-broke` inevitably fails to find changelog entries for some packages/releases +`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`](https://github.com/semantic-release/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). `what-broke` currently +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, `what-broke` will use it when requesting GitHub releases. +personal access token, `npm-fetch-changelog` will use it when requesting GitHub releases. -`what-broke` will also use the `NPM_TOKEN` environment variable or try to get +`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. # CLI ``` -npm i -g what-broke +npm i -g npm-fetch-changelog ``` ``` -what-broke +npm-fetch-changelog ``` Prints changelog entries fetched from GitHub for each @@ -58,6 +58,10 @@ version released on npm in the given 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) +### `--json` + +output JSON instead of Markdown + ### `--prereleases` include prerelease versions @@ -75,11 +79,11 @@ exclude patch versions (defaults to `--no-minor`) (the CLI just uses this under the hood) ```js -import whatBroke from 'what-broke' +import { fetchChangelog } from 'npm-fetch-changelog' ``` ```js -async function whatBroke( +async function fetchChangelog( package: string, options?: { include?: ?(((version: string) => boolean) | { @@ -89,5 +93,11 @@ async function whatBroke( patch?: ?boolean, }), } -): Promise> +): Promise<{[version: string]: { + version: string, + header: string, + body?: string, + date?: Date, + error?: Error, +}}> ``` diff --git a/package.json b/package.json index 66b55b7..fe0c435 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "what-broke", + "name": "npm-fetch-changelog", "version": "0.0.0-development", "description": "list breaking changes in newer major versions of packages", "main": "index.js", "bin": { - "what-broke": "./index.js" + "npm-fetch-changelog": "./index.js" }, "engines": { "node": ">=8.0.0" @@ -71,7 +71,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/jedwards1211/what-broke.git" + "url": "https://github.com/jedwards1211/npm-fetch-changelog.git" }, "keywords": [ "breaking-changes", @@ -86,9 +86,9 @@ "author": "Andy Edwards", "license": "MIT", "bugs": { - "url": "https://github.com/jedwards1211/what-broke/issues" + "url": "https://github.com/jedwards1211/npm-fetch-changelog/issues" }, - "homepage": "https://github.com/jedwards1211/what-broke#readme", + "homepage": "https://github.com/jedwards1211/npm-fetch-changelog#readme", "devDependencies": { "@babel/cli": "^7.4.4", "@babel/core": "^7.1.6",