Skip to content

Commit 86a521c

Browse files
committed
feat: add what-broke CLI command
1 parent a20646e commit 86a521c

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ npm i -g npm-fetch-changelog
5656

5757
```
5858
npm-fetch-changelog <package name>[@<range>]
59+
what-broke <package name>[@<range>]
5960
```
6061

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

65+
`what-broke` is just a shortcut for `npm-fetch-changelog --no-minor`.
66+
6467
## Options:
6568

6669
### `-r`, `--range`

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@
132132
"yargs": "^13.2.2"
133133
},
134134
"bin": {
135-
"npm-fetch-changelog": "./cli.js"
135+
"npm-fetch-changelog": "./cli/npm-fetch-changelog.js",
136+
"what-broke": "./cli/what-broke.js"
136137
},
137138
"engines": {
138139
"node": ">=12"

src/cli.js renamed to src/cli/npm-fetch-changelog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import chalk from 'chalk'
55
import yargs from 'yargs'
66
import path from 'path'
7-
import { fetchChangelog } from './index'
8-
import { type Release } from './parseChangelog'
7+
import { fetchChangelog } from '../index'
8+
import { type Release } from '../parseChangelog'
99

1010
/* eslint-env node */
1111
const { argv } = yargs

src/cli/what-broke.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
3+
// @flow
4+
5+
import { spawn } from 'child_process'
6+
7+
const child = spawn(
8+
process.execPath,
9+
[
10+
require.resolve('./npm-fetch-changelog.js'),
11+
...process.argv.slice(2),
12+
'--no-minor',
13+
],
14+
{
15+
stdio: 'inherit',
16+
}
17+
)
18+
child.on('error', (error: Error) => {
19+
// eslint-disable-next-line no-console
20+
console.error(error.stack)
21+
process.exit(1)
22+
})
23+
child.on('close', (code?: number, signal?: string) => {
24+
if (code != null) process.exit(code)
25+
process.exit(signal ? 1 : 0)
26+
})

yarn.lock

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5866,6 +5866,11 @@ nerf-dart@^1.0.0:
58665866
resolved "https://registry.npmjs.org/nerf-dart/-/nerf-dart-1.0.0.tgz#e6dab7febf5ad816ea81cf5c629c5a0ebde72c1a"
58675867
integrity sha1-5tq3/r9a2Bbqgc9cYpxaDr3nLBo=
58685868

5869+
nice-try@^1.0.4:
5870+
version "1.0.5"
5871+
resolved "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
5872+
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
5873+
58695874
node-emoji@^1.10.0:
58705875
version "1.10.0"
58715876
resolved "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz#8886abd25d9c7bb61802a658523d1f8d2a89b2da"
@@ -6693,7 +6698,7 @@ path-is-inside@^1.0.1, path-is-inside@^1.0.2, path-is-inside@~1.0.2:
66936698
resolved "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
66946699
integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=
66956700

6696-
path-key@^2.0.0:
6701+
path-key@^2.0.0, path-key@^2.0.1:
66976702
version "2.0.1"
66986703
resolved "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
66996704
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=

0 commit comments

Comments
 (0)