Skip to content

Commit f2616c0

Browse files
authored
[ts-command-line] Remove deprecations and perform updates planned for the next major bump. (#5203)
* Remove deprecated functions. * Renames. * fixup! Remove deprecated functions. * fixup! Remove deprecated functions. * fixup! Remove deprecated functions.
1 parent d3693b5 commit f2616c0

File tree

76 files changed

+298
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+298
-242
lines changed

apps/api-documenter/src/cli/BaseAction.ts

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export abstract class BaseAction extends CommandLineAction {
3232
protected constructor(options: ICommandLineActionOptions) {
3333
super(options);
3434

35-
// override
3635
this._inputFolderParameter = this.defineStringParameter({
3736
parameterLongName: '--input-folder',
3837
parameterShortName: '-i',

apps/api-documenter/src/cli/GenerateAction.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ export class GenerateAction extends BaseAction {
2222
});
2323
}
2424

25-
protected async onExecute(): Promise<void> {
26-
// override
25+
protected override async onExecuteAsync(): Promise<void> {
2726
// Look for the config file under the current folder
2827

2928
let configFilePath: string = path.join(process.cwd(), DocumenterConfig.FILENAME);

apps/api-documenter/src/cli/MarkdownAction.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ export class MarkdownAction extends BaseAction {
1616
});
1717
}
1818

19-
protected async onExecute(): Promise<void> {
20-
// override
19+
protected override async onExecuteAsync(): Promise<void> {
2120
const { apiModel, outputFolder } = this.buildApiModel();
2221

2322
const markdownDocumenter: MarkdownDocumenter = new MarkdownDocumenter({

apps/api-documenter/src/cli/YamlAction.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ export class YamlAction extends BaseAction {
5050
});
5151
}
5252

53-
protected async onExecute(): Promise<void> {
54-
// override
53+
protected override async onExecuteAsync(): Promise<void> {
5554
const { apiModel, inputFolder, outputFolder } = this.buildApiModel();
5655

5756
const yamlDocumenter: YamlDocumenter = this._officeParameter.value

apps/api-documenter/src/documenters/OfficeYamlDocumenter.ts

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export class OfficeYamlDocumenter extends YamlDocumenter {
6565

6666
/** @override */
6767
protected onGetTocRoot(): IYamlTocItem {
68-
// override
6968
return {
7069
name: 'API reference',
7170
href: 'overview.md',

apps/api-extractor/src/cli/ApiExtractorCommandLine.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,22 @@ export class ApiExtractorCommandLine extends CommandLineParser {
3232
});
3333
}
3434

35-
protected onExecute(): Promise<void> {
36-
// override
35+
protected override async onExecuteAsync(): Promise<void> {
3736
if (this._debugParameter.value) {
3837
InternalError.breakInDebugger = true;
3938
}
4039

41-
return super.onExecute().catch((error) => {
40+
process.exitCode = 1;
41+
try {
42+
await super.onExecuteAsync();
43+
process.exitCode = 0;
44+
} catch (error) {
4245
if (this._debugParameter.value) {
4346
console.error(os.EOL + error.stack);
4447
} else {
4548
console.error(os.EOL + Colorize.red('ERROR: ' + error.message.trim()));
4649
}
47-
48-
process.exitCode = 1;
49-
});
50+
}
5051
}
5152

5253
private _populateActions(): void {

apps/api-extractor/src/cli/InitAction.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export class InitAction extends CommandLineAction {
2121
});
2222
}
2323

24-
protected async onExecute(): Promise<void> {
25-
// override
24+
protected override async onExecuteAsync(): Promise<void> {
2625
const inputFilePath: string = path.resolve(__dirname, '../schemas/api-extractor-template.json');
2726
const outputFilePath: string = path.resolve(ExtractorConfig.FILENAME);
2827

apps/api-extractor/src/cli/RunAction.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ export class RunAction extends CommandLineAction {
7171
});
7272
}
7373

74-
protected async onExecute(): Promise<void> {
75-
// override
74+
protected override async onExecuteAsync(): Promise<void> {
7675
const lookup: PackageJsonLookup = new PackageJsonLookup();
7776
let configFilename: string;
7877

apps/cpu-profile-summarizer/src/start.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class CpuProfileSummarizerCommandLineParser extends CommandLineParser {
147147
});
148148
}
149149

150-
protected async onExecute(): Promise<void> {
150+
protected override async onExecuteAsync(): Promise<void> {
151151
const input: readonly string[] = this._inputParameter.values;
152152
const output: string = this._outputParameter.value;
153153

apps/heft/src/cli/HeftCommandLineParser.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export class HeftCommandLineParser extends CommandLineParser {
176176
}
177177
}
178178

179-
protected async onExecute(): Promise<void> {
179+
protected override async onExecuteAsync(): Promise<void> {
180180
try {
181181
const selectedAction: CommandLineAction | undefined = this.selectedAction;
182182

@@ -196,7 +196,7 @@ export class HeftCommandLineParser extends CommandLineParser {
196196
commandName,
197197
unaliasedCommandName
198198
};
199-
await super.onExecute();
199+
await super.onExecuteAsync();
200200
} catch (e) {
201201
await this._reportErrorAndSetExitCodeAsync(e as Error);
202202
}
@@ -228,7 +228,7 @@ export class HeftCommandLineParser extends CommandLineParser {
228228
// try to evaluate any parameters. This is to ensure that the
229229
// `--debug` flag is defined correctly before we do this not-so-rigorous
230230
// parameter parsing.
231-
throw new InternalError('onDefineParameters() has not yet been called.');
231+
throw new InternalError('parameters have not yet been defined.');
232232
}
233233

234234
const toolParameters: Set<string> = getToolParameterNamesFromArgs(args);

apps/heft/src/cli/actions/AliasAction.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class AliasAction extends AliasCommandLineAction {
2222
this._terminal = options.terminal;
2323
}
2424

25-
protected async onExecute(): Promise<void> {
25+
protected override async onExecuteAsync(): Promise<void> {
2626
const toolFilename: string = this._toolFilename;
2727
const actionName: string = this.actionName;
2828
const targetAction: CommandLineAction = this.targetAction;
@@ -34,6 +34,6 @@ export class AliasAction extends AliasCommandLineAction {
3434
`${defaultParametersString ? ` ${defaultParametersString}` : ''}".`
3535
);
3636

37-
await super.onExecute();
37+
await super.onExecuteAsync();
3838
}
3939
}

apps/heft/src/cli/actions/CleanAction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class CleanAction extends CommandLineAction implements IHeftAction {
7676
return this._selectedPhases;
7777
}
7878

79-
protected async onExecute(): Promise<void> {
79+
protected override async onExecuteAsync(): Promise<void> {
8080
const { heftConfiguration } = this._internalHeftSession;
8181
const abortSignal: AbortSignal = ensureCliAbortSignal(this._terminal);
8282

apps/heft/src/cli/actions/PhaseAction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class PhaseAction extends CommandLineAction implements IHeftAction {
4747
return this._selectedPhases;
4848
}
4949

50-
protected async onExecute(): Promise<void> {
50+
protected override async onExecuteAsync(): Promise<void> {
5151
await this._actionRunner.executeAsync();
5252
}
5353
}

apps/heft/src/cli/actions/RunAction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class RunAction extends ScopedCommandLineAction implements IHeftAction {
145145
this._actionRunner.defineParameters(scopedParameterProvider);
146146
}
147147

148-
protected async onExecute(): Promise<void> {
148+
protected override async onExecuteAsync(): Promise<void> {
149149
await this._actionRunner.executeAsync();
150150
}
151151
}

apps/lockfile-explorer/src/cli/explorer/ExplorerCommandLineParser.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class ExplorerCommandLineParser extends CommandLineParser {
5959
return this._debugParameter.value;
6060
}
6161

62-
protected async onExecute(): Promise<void> {
62+
protected override async onExecuteAsync(): Promise<void> {
6363
const lockfileExplorerProjectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;
6464
const lockfileExplorerPackageJson: IPackageJson = JsonFile.load(
6565
`${lockfileExplorerProjectRoot}/package.json`

apps/lockfile-explorer/src/cli/lint/LintCommandLineParser.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class LintCommandLineParser extends CommandLineParser {
2626
this._populateActions();
2727
}
2828

29-
protected override async onExecute(): Promise<void> {
29+
protected override async onExecuteAsync(): Promise<void> {
3030
const lockfileExplorerProjectRoot: string = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname)!;
3131
const lockfileExplorerPackageJson: IPackageJson = JsonFile.load(
3232
`${lockfileExplorerProjectRoot}/package.json`
@@ -37,7 +37,7 @@ export class LintCommandLineParser extends CommandLineParser {
3737
Colorize.bold(`\nRush Lockfile Lint ${appVersion}`) + Colorize.cyan(' - https://lfx.rushstack.io/\n')
3838
);
3939

40-
await super.onExecute();
40+
await super.onExecuteAsync();
4141
}
4242

4343
private _populateActions(): void {

apps/lockfile-explorer/src/cli/lint/actions/CheckAction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export class CheckAction extends CommandLineAction {
174174
}
175175
}
176176

177-
protected async onExecute(): Promise<void> {
177+
protected override async onExecuteAsync(): Promise<void> {
178178
const rushConfiguration: RushConfiguration | undefined = RushConfiguration.tryLoadFromDefaultLocation();
179179
if (!rushConfiguration) {
180180
throw new Error(

apps/lockfile-explorer/src/cli/lint/actions/InitAction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class InitAction extends CommandLineAction {
2525
this._terminal = parser.globalTerminal;
2626
}
2727

28-
protected async onExecute(): Promise<void> {
28+
protected override async onExecuteAsync(): Promise<void> {
2929
const rushConfiguration: RushConfiguration | undefined = RushConfiguration.tryLoadFromDefaultLocation();
3030
if (!rushConfiguration) {
3131
throw new Error(

apps/rundown/src/cli/InspectAction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class InspectAction extends BaseReportAction {
2525
});
2626
}
2727

28-
protected async onExecute(): Promise<void> {
28+
protected override async onExecuteAsync(): Promise<void> {
2929
const rundown: Rundown = new Rundown();
3030
await rundown.invokeAsync(
3131
this.scriptParameter.value,

apps/rundown/src/cli/SnapshotAction.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class SnapshotAction extends BaseReportAction {
1616
});
1717
}
1818

19-
protected async onExecute(): Promise<void> {
19+
protected override async onExecuteAsync(): Promise<void> {
2020
const rundown: Rundown = new Rundown();
2121
await rundown.invokeAsync(
2222
this.scriptParameter.value,

apps/trace-import/src/TraceImportCommandLineParser.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ export class TraceImportCommandLineParser extends CommandLineParser {
6666
});
6767
}
6868

69-
protected async onExecute(): Promise<void> {
70-
// override
69+
protected override async onExecuteAsync(): Promise<void> {
7170
if (this._debugParameter.value) {
7271
InternalError.breakInDebugger = true;
7372
}

build-tests/api-extractor-test-05/dist/tsdoc-metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"toolPackages": [
66
{
77
"packageName": "@microsoft/api-extractor",
8-
"packageVersion": "7.51.1"
8+
"packageVersion": "7.52.4"
99
}
1010
]
1111
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/api-documenter",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/api-documenter"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/api-extractor",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/api-extractor"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/cpu-profile-summarizer",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@rushstack/cpu-profile-summarizer"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/heft",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@rushstack/heft"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/lockfile-explorer",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@rushstack/lockfile-explorer"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/node-core-library",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@rushstack/node-core-library"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/package-extractor",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@rushstack/package-extractor"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/rundown",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@rushstack/rundown"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/trace-import",
5+
"comment": "",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@rushstack/trace-import"
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/ts-command-line",
5+
"comment": "Remove the deprecated `onDefineParameters`, `execute`, `executeWithoutErrorHandling`, and `onDefineUnscopedParameters` functions.",
6+
"type": "major"
7+
}
8+
],
9+
"packageName": "@rushstack/ts-command-line"
10+
}

0 commit comments

Comments
 (0)