Skip to content

Commit

Permalink
Prepare for 13.0.0 (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowspawn authored Dec 31, 2024
1 parent bd0b140 commit 074b8aa
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 11 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The version numbering does not follow semantic versioning but instead aligns wit
<!-- markdownlint-disable MD024 -->
<!-- markdownlint-disable MD004 -->

## [13.0.0-1] (2024-12-08)
## [13.0.0] (2024-12-31)

### Added

Expand All @@ -21,6 +21,10 @@ The version numbering does not follow semantic versioning but instead aligns wit

- *Breaking:* Typescript 5.0 or higher is required ([#79])

## [13.0.0-1] (2024-12-08)

(Released in 13.0.0)

## 13.0.0-0 (2024-12-08) [YANKED]

Published from wrong branch.
Expand Down Expand Up @@ -184,6 +188,7 @@ Published from wrong branch.
- inferred types for `.action()`
- inferred types for `.opts()`

[13.0.0]: https://github.com/commander-js/extra-typings/compare/v12.1.0...v13.0.0
[13.0.0-1]: https://github.com/commander-js/extra-typings/compare/v12.1.0...v13.0.0-1
[12.1.0]: https://github.com/commander-js/extra-typings/compare/v12.0.1...v12.1.0
[12.0.1]: https://github.com/commander-js/extra-typings/compare/v12.0.0...v12.0.1
Expand Down
16 changes: 16 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,22 @@ export class Command<
*/
parseAsync(argv?: readonly string[], options?: ParseOptions): Promise<this>;

/**
* Called the first time parse is called to save state and allow a restore before subsequent calls to parse.
* Not usually called directly, but available for subclasses to save their custom state.
*
* This is called in a lazy way. Only commands used in parsing chain will have state saved.
*/
saveStateBeforeParse(): void;

/**
* Restore state before parse for calls after the first.
* Not usually called directly, but available for subclasses to save their custom state.
*
* This is called in a lazy way. Only commands used in parsing chain will have state restored.
*/
restoreStateBeforeParse(): void;

/**
* Parse options from `argv` removing known options,
* and return argv split into operands and unknown arguments.
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@commander-js/extra-typings",
"version": "13.0.0-1",
"version": "13.0.0",
"description": "Infer strong typings for commander options and action handlers",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -43,12 +43,12 @@
},
"homepage": "https://github.com/commander-js/extra-typings#readme",
"peerDependencies": {
"commander": "~13.0.0-0"
"commander": "~13.0.0"
},
"devDependencies": {
"@jest/globals": "^29.3.1",
"@types/node": "^22.10.1",
"commander": "~13.0.0-0",
"commander": "^13.0.0",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.9.0",
Expand Down
4 changes: 4 additions & 0 deletions tests/commander.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,10 @@ expectType<{ operands: string[]; unknown: string[] }>(
program.parseOptions(['node', 'script.js', 'hello']),
);

// save/restore state
expectType<void>(program.saveStateBeforeParse());
expectType<void>(program.restoreStateBeforeParse());

// opts
const opts = program.opts();
expectAssignable<commander.OptionValues>(opts);
Expand Down

0 comments on commit 074b8aa

Please sign in to comment.