Skip to content

Commit 41d0bdb

Browse files
authored
Add explicit breaking notes (#1006)
* Add explicit breaking notes * Move fullstop
1 parent 5b1b2fe commit 41d0bdb

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

CHANGELOG.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
* Add option to specify executable file name ([#999])
55
* e.g. `.command('clone', 'clone description', { executableFile: 'myClone' })`
6-
* Change docs for `.command` to contrast action handler vs git-style executable. TypeScript now uses overloaded function. ([#938] [#990])
6+
* Change docs for `.command` to contrast action handler vs git-style executable. ([#938] [#990])
7+
* **Breaking** Change TypeScript to use overloaded function for `.command`. ([#938] [#990])
78
* Change to use straight quotes around strings in error messages (like 'this' instead of `this') ([#915])
89
* Add TypeScript "reference types" for node ([#974])
910
* Add support for hyphen as an option argument in subcommands ([#697])
@@ -18,12 +19,34 @@
1819
* e.g. `.helpOption('-e, --HELP', 'read more information')`
1920
* Fix behavior of --no-* options ([#795])
2021
* can now define both `--foo` and `--no-foo`
21-
* custom event listeners: `--no-foo` on cli now emits `option:no-foo` (previously `option:foo`)
22-
* default value: defining `--no-foo` after defining `--foo` leaves the default value unchanged (previously set it to false)
22+
* **Breaking** custom event listeners: `--no-foo` on cli now emits `option:no-foo` (previously `option:foo`)
23+
* **Breaking** default value: defining `--no-foo` after defining `--foo` leaves the default value unchanged (previously set it to false)
2324
* allow boolean default value, such as from environment ([#987])
2425
* Increment inspector port for spawned subcommands ([#991])
2526
* e.g. `node --inspect myCommand.js clone`
26-
27+
28+
Example Breaking Changes
29+
------------------------
30+
31+
The custom event for a negated option like `--no-foo` is `option:no-foo` (previously `option:foo`).
32+
33+
```js
34+
program
35+
.option('--no-foo')
36+
.on('option:no-foo', () => {
37+
console.log('removing foo');
38+
});
39+
```
40+
41+
When using TypeScript, adding a command does not allow an explicit `undefined` for an unwanted executable description (e.g
42+
for a command with an action handler).
43+
44+
```js
45+
program
46+
.command('action1', undefined, { noHelp: true }) // No longer valid
47+
.command('action2', { noHelp: true }) // Correct
48+
```
49+
2750
[#599]: https://github.com/tj/commander.js/issues/599
2851
[#611]: https://github.com/tj/commander.js/issues/611
2952
[#697]: https://github.com/tj/commander.js/issues/697

0 commit comments

Comments
 (0)