From 53fc8a4b287e063af0bd3a026cad06bf1cf07bcf Mon Sep 17 00:00:00 2001 From: John Gee Date: Sat, 7 Dec 2024 08:51:46 +1300 Subject: [PATCH] Prepare for 13.0.0-0 (#2292) --- CHANGELOG.md | 26 +++++++++++++++++++++----- lib/command.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8d11c73f..18fc504f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,23 +2,37 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [13.x] (date goes here) +## [13.0.0-1] (2024-12-08) + +### Added + +- style routines like `styleTitle()` to add color to help using `.configureHelp()` or Help subclass ([#2251]) +- color related support in `.configureOutput()` for `getOutHasColors()`, `getErrHasColors()`, and `stripColor()` ([#2251]) +- Help property for `minWidthToWrap` ([#2251]) +- Help methods for `displayWidth()`, `boxWrap()`, `preformatted()` et al ([#2251]) ### Changed -- *Breaking*: excess command-arguments cause an error by default +- *Breaking*: excess command-arguments cause an error by default, see migration tips ([#2223]) +- *Breaking*: throw during Option construction for unsupported option flags, like multiple characters after single `-` ([#2270]) +- TypeScript: include implicit `this` in parameters for action handler callback ([#2197]) + +### Deleted + +- *Breaking*: `Help.wrap()` refactored into `formatItem()` and `boxWrap()` ([#2251]) + ### Migration Tips **Excess command-arguments** -It is now an error to pass more command-arguments than are expected. +It is now an error for the user to specify more command-arguments than are expected. (`allowExcessArguments` is now false by default.) Old code: @@ -29,6 +43,8 @@ program.action((options) => { }); ``` +Now shows an error: + ```console $ node example.js a b c error: too many arguments. Expected 0 arguments but got 3. @@ -45,7 +61,7 @@ program.action((args, options) => { }); ``` -Or you could suppress the error without changing the rest of the code: +Or you could suppress the error, useful for minimising changes in legacy code. ```js program.option('-p, --port', 'port number'); diff --git a/lib/command.js b/lib/command.js index cfcbfc5f2..ac36d8d0d 100644 --- a/lib/command.js +++ b/lib/command.js @@ -229,7 +229,7 @@ class Command extends EventEmitter { * // color support, currently only used with Help * getOutHasColors() * getErrHasColors() - * stripColor() // used to remove ANSI escape codes if output does not have colours + * stripColor() // used to remove ANSI escape codes if output does not have colors * * @param {object} [configuration] - configuration options * @return {(Command | object)} `this` command for chaining, or stored configuration diff --git a/package-lock.json b/package-lock.json index 80cdd786b..07d8cd97d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "commander", - "version": "12.1.0", + "version": "13.0.0-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "commander", - "version": "12.1.0", + "version": "13.0.0-0", "license": "MIT", "devDependencies": { "@eslint/js": "^9.4.0", diff --git a/package.json b/package.json index a016e1fad..d953e83fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "commander", - "version": "12.1.0", + "version": "13.0.0-0", "description": "the complete solution for node.js command-line programs", "keywords": [ "commander",