Skip to content

Commit

Permalink
Update names of async functions to end with 'Async.'
Browse files Browse the repository at this point in the history
  • Loading branch information
iclanton committed May 15, 2024
1 parent d291fd8 commit 3c419dc
Show file tree
Hide file tree
Showing 113 changed files with 927 additions and 544 deletions.
2 changes: 1 addition & 1 deletion apps/api-documenter/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ console.log(

const parser: ApiDocumenterCommandLine = new ApiDocumenterCommandLine();

parser.execute().catch(console.error); // CommandLineParser.execute() should never reject the promise
parser.executeAsync().catch(console.error); // CommandLineParser.executeAsync() should never reject the promise
2 changes: 1 addition & 1 deletion apps/api-extractor/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ console.log(

const parser: ApiExtractorCommandLine = new ApiExtractorCommandLine();

parser.execute().catch((error) => {
parser.executeAsync().catch((error) => {
console.error(Colorize.red(`An unexpected error occurred: ${error}`));
process.exit(1);
});
10 changes: 5 additions & 5 deletions apps/heft/src/cli/HeftCommandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class HeftCommandLineParser extends CommandLineParser {
this._metricsCollector = new MetricsCollector();
}

public async execute(args?: string[]): Promise<boolean> {
public async executeAsync(args?: string[]): Promise<boolean> {
// Defensively set the exit code to 1 so if the tool crashes for whatever reason,
// we'll have a nonzero exit code.
process.exitCode = 1;
Expand Down Expand Up @@ -166,9 +166,9 @@ export class HeftCommandLineParser extends CommandLineParser {
this.addAction(aliasAction);
}

return await super.execute(args);
return await super.executeAsync(args);
} catch (e) {
await this._reportErrorAndSetExitCode(e as Error);
await this._reportErrorAndSetExitCodeAsync(e as Error);
return false;
}
}
Expand All @@ -195,7 +195,7 @@ export class HeftCommandLineParser extends CommandLineParser {
};
await super.onExecute();
} catch (e) {
await this._reportErrorAndSetExitCode(e as Error);
await this._reportErrorAndSetExitCodeAsync(e as Error);
}

// If we make it here, things are fine and reset the exit code back to 0
Expand Down Expand Up @@ -235,7 +235,7 @@ export class HeftCommandLineParser extends CommandLineParser {
};
}

private async _reportErrorAndSetExitCode(error: Error): Promise<void> {
private async _reportErrorAndSetExitCodeAsync(error: Error): Promise<void> {
if (!(error instanceof AlreadyReportedError)) {
this.globalTerminal.writeErrorLine(error.toString());
}
Expand Down
4 changes: 2 additions & 2 deletions apps/heft/src/plugins/NodeServicePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default class NodeServicePlugin implements IHeftTaskPlugin {
);
}

private async _loadStageConfiguration(
private async _loadStageConfigurationAsync(
taskSession: IHeftTaskSession,
heftConfiguration: HeftConfiguration
): Promise<void> {
Expand Down Expand Up @@ -187,7 +187,7 @@ export default class NodeServicePlugin implements IHeftTaskPlugin {
taskSession: IHeftTaskSession,
heftConfiguration: HeftConfiguration
): Promise<void> {
await this._loadStageConfiguration(taskSession, heftConfiguration);
await this._loadStageConfigurationAsync(taskSession, heftConfiguration);
if (!this._pluginEnabled) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/heft/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HeftCommandLineParser } from './cli/HeftCommandLineParser';
const parser: HeftCommandLineParser = new HeftCommandLineParser();

parser
.execute()
.executeAsync()
.then(() => {
// This should be removed when the issue with aria not tearing down
process.exit(process.exitCode === undefined ? 0 : process.exitCode);
Expand Down
2 changes: 1 addition & 1 deletion apps/rundown/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ console.log(`Rundown ${toolVersion} - https://rushstack.io`);
console.log();

const commandLine: RundownCommandLine = new RundownCommandLine();
commandLine.execute().catch((error) => {
commandLine.executeAsync().catch((error) => {
console.error(error);
});
2 changes: 1 addition & 1 deletion apps/trace-import/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ console.log(Colorize.bold(`trace-import ${toolVersion}`) + ' - ' + Colorize.cyan
console.log();

const commandLine: TraceImportCommandLineParser = new TraceImportCommandLineParser();
commandLine.execute().catch((error) => {
commandLine.executeAsync().catch((error) => {
console.error(error);
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ async function rushRush(args: string[]): Promise<void> {
// eslint-disable-next-line no-console
console.log(`Executing: rush ${args.join(' ')}`);
await parser
.execute(args)
.executeAsync(args)
// eslint-disable-next-line no-console
.catch(console.error); // CommandLineParser.execute() should never reject the promise
.catch(console.error); // CommandLineParser.executeAsync() should never reject the promise
}

// eslint-disable-next-line no-console
Expand Down
2 changes: 1 addition & 1 deletion build-tests/ts-command-line-test/src/BusinessLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// See LICENSE in the project root for license information.

export class BusinessLogic {
public static async doTheWork(force: boolean, protocol: string): Promise<void> {
public static async doTheWorkAsync(force: boolean, protocol: string): Promise<void> {
console.log(`Received parameters: force=${force}, protocol="${protocol}"`);
console.log(`Business logic did the work.`);
}
Expand Down
2 changes: 1 addition & 1 deletion build-tests/ts-command-line-test/src/PushAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class PushAction extends CommandLineAction {

protected onExecute(): Promise<void> {
// abstract
return BusinessLogic.doTheWork(this._force.value, this._protocol.value);
return BusinessLogic.doTheWorkAsync(this._force.value, this._protocol.value);
}

protected onDefineParameters(): void {
Expand Down
2 changes: 1 addition & 1 deletion build-tests/ts-command-line-test/src/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
import { WidgetCommandLine } from './WidgetCommandLine';

const commandLine: WidgetCommandLine = new WidgetCommandLine();
commandLine.execute();
commandLine.executeAsync();
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/api-documenter",
"comment": "",
"type": "none"
}
],
"packageName": "@microsoft/api-documenter"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/api-extractor",
"comment": "",
"type": "none"
}
],
"packageName": "@microsoft/api-extractor"
}
10 changes: 10 additions & 0 deletions common/changes/@microsoft/rush/async-naming_2024-05-14-02-29.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/eslint-config",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/eslint-config"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft-jest-plugin",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/heft-jest-plugin"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft-sass-plugin",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/heft-sass-plugin"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft-typescript-plugin",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/heft-typescript-plugin"
}
10 changes: 10 additions & 0 deletions common/changes/@rushstack/heft/async-naming_2024-05-14-02-29.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/heft",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/heft"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/module-minifier",
"comment": "Rename `IMinifierConnection.disconnect` to `IMinifierConnection.disconnectAsync` and `IModuleMinifier.connect` to `IModuleMinifier.connectAsync`. The old functions are marked as `@deprecated`.",
"type": "minor"
}
],
"packageName": "@rushstack/module-minifier"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/node-core-library",
"comment": "Rename `Async.sleep` to `Async.sleepAsync`. The old function is marked as `@deprecated`.",
"type": "minor"
}
],
"packageName": "@rushstack/node-core-library"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/operation-graph",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/operation-graph"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/rundown",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/rundown"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/trace-import",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/trace-import"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/ts-command-line",
"comment": "Rename `CommandLineParser.execute` to `CommandLineParser.executeAsync` and `CommandLineParser.executeWithoutErrorHandling` to `CommandLineParser.executeWithoutErrorHandlingAsync`. The old functions are marked as `@deprecated`.",
"type": "minor"
}
],
"packageName": "@rushstack/ts-command-line"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/typings-generator",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/typings-generator"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/webpack4-module-minifier-plugin",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/webpack4-module-minifier-plugin"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@rushstack/webpack5-module-minifier-plugin",
"comment": "",
"type": "none"
}
],
"packageName": "@rushstack/webpack5-module-minifier-plugin"
}
16 changes: 12 additions & 4 deletions common/reviews/api/module-minifier.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export interface ILocalMinifierOptions {
// @public
export interface IMinifierConnection {
configHash: string;
// @deprecated (undocumented)
disconnect(): Promise<void>;
disconnectAsync(): Promise<void>;
}

// @public
Expand Down Expand Up @@ -60,7 +62,9 @@ export interface IModuleMinificationSuccessResult {

// @public
export interface IModuleMinifier {
// @deprecated (undocumented)
connect(): Promise<IMinifierConnection>;
connectAsync(): Promise<IMinifierConnection>;
minify: IModuleMinifierFunction;
}

Expand All @@ -80,16 +84,18 @@ export interface IWorkerPoolMinifierOptions {
// @public
export class LocalMinifier implements IModuleMinifier {
constructor(options: ILocalMinifierOptions);
// (undocumented)
// @deprecated (undocumented)
connect(): Promise<IMinifierConnection>;
connectAsync(): Promise<IMinifierConnection>;
minify(request: IModuleMinificationRequest, callback: IModuleMinificationCallback): void;
}

// @public
export class MessagePortMinifier implements IModuleMinifier {
constructor(port: MessagePort_2);
// (undocumented)
// @deprecated (undocumented)
connect(): Promise<IMinifierConnection>;
connectAsync(): Promise<IMinifierConnection>;
minify(request: IModuleMinificationRequest, callback: IModuleMinificationCallback): void;
// (undocumented)
readonly port: MessagePort_2;
Expand All @@ -102,16 +108,18 @@ export function _minifySingleFileAsync(request: IModuleMinificationRequest, ters

// @public
export class NoopMinifier implements IModuleMinifier {
// (undocumented)
// @deprecated (undocumented)
connect(): Promise<IMinifierConnection>;
connectAsync(): Promise<IMinifierConnection>;
minify(request: IModuleMinificationRequest, callback: IModuleMinificationCallback): void;
}

// @public
export class WorkerPoolMinifier implements IModuleMinifier {
constructor(options: IWorkerPoolMinifierOptions);
// (undocumented)
// @deprecated (undocumented)
connect(): Promise<IMinifierConnection>;
connectAsync(): Promise<IMinifierConnection>;
// (undocumented)
get maxThreads(): number;
set maxThreads(threads: number);
Expand Down
Loading

0 comments on commit 3c419dc

Please sign in to comment.