Skip to content

Commit e67f00b

Browse files
Copilotadrians5j
andauthored
fix: rename CliCommand to CliCommandFactory (#4880)
Co-authored-by: adrians5j <adrian@webiny.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: adrians5j <5121148+adrians5j@users.noreply.github.com>
1 parent 480c909 commit e67f00b

File tree

35 files changed

+149
-124
lines changed

35 files changed

+149
-124
lines changed

extensions/MyCustomCommand.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { CliCommand } from "webiny/cli/features/CliCommand";
1+
import { CliCommandFactory } from "webiny/cli/features/CliCommand";
22
import { UiService } from "webiny/cli/features/Ui";
33

44
export interface IMyCustomCommandParams {
55
name: string;
66
}
77

8-
class MyCustomCommandImpl implements CliCommand.Interface<IMyCustomCommandParams> {
8+
class MyCustomCommandImpl implements CliCommandFactory.Interface<IMyCustomCommandParams> {
99
constructor(private ui: UiService.Interface) {}
1010

11-
execute(): CliCommand.CommandDefinition<IMyCustomCommandParams> {
11+
execute(): CliCommandFactory.CommandDefinition<IMyCustomCommandParams> {
1212
return {
1313
name: "my-custom-command",
1414
description: "This is my custom command",
@@ -22,14 +22,14 @@ class MyCustomCommandImpl implements CliCommand.Interface<IMyCustomCommandParams
2222
],
2323
handler: async params => {
2424
this.ui.info("Starting my custom command...");
25-
this.ui.newLine();
25+
this.ui.emptyLine();
2626
this.ui.success(`Hello, ${params.name}! This is my custom command.`);
2727
}
2828
};
2929
}
3030
}
3131

32-
export const MyCustomCommand = CliCommand.createImplementation({
32+
export const MyCustomCommand = CliCommandFactory.createImplementation({
3333
implementation: MyCustomCommandImpl,
3434
dependencies: [UiService]
3535
});

packages/admin-ui/src/Tag/Tag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const tagVariants = cva(
3333
],
3434
"neutral-base-outline": [
3535
"border-sm border-solid px-[calc(var(--padding-xs-plus)-(var(--border-width-sm)))] py-[calc(var(--padding-xxs)-(var(--border-width-sm)))]",
36-
"bg-transparent border-neutral-muted text-neutral-primary",
36+
"bg-neutral-base border-neutral-muted text-neutral-primary",
3737
"hover:bg-neutral-light",
3838
"aria-disabled:bg-transparent aria-disabled:border-neutral-dimmed aria-disabled:text-neutral-disabled"
3939
],

packages/cli-core/src/abstractions/features/CliCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ export interface ICliCommand<TCommandParams> {
3636
| ICliCommandDefinition<TCommandParams>;
3737
}
3838

39-
export const CliCommand = createAbstraction<ICliCommand<any>>("CliCommand");
39+
export const CliCommandFactory = createAbstraction<ICliCommand<any>>("CliCommandFactory");
4040

41-
export namespace CliCommand {
41+
export namespace CliCommandFactory {
4242
export type Interface<TCommandParams> = ICliCommand<TCommandParams>;
4343

4444
export type ParamDefinition<TCommandParams> = ICliCommandParamDefinition<TCommandParams>;

packages/cli-core/src/abstractions/features/ErrorHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { createAbstraction } from "~/abstractions/createAbstraction.js";
2-
import { CliCommand } from "~/abstractions/index.js";
2+
import { CliCommandFactory } from "~/abstractions/index.js";
33

44
export type IError = Error;
55

66
export interface IErrorHandlerParams<TParams> {
77
error: Error;
8-
command: CliCommand.CommandDefinition<any>;
8+
command: CliCommandFactory.CommandDefinition<any>;
99
params: TParams;
1010
}
1111

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { CliCommand } from "./CliCommand.js";
1+
export { CliCommandFactory } from "./CliCommand.js";
22
export { ErrorHandler } from "./ErrorHandler.js";
33
export { GlobalCliOption } from "./GlobalCliOption.js";

packages/cli-core/src/abstractions/services/CommandsRegistryService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { createAbstraction } from "~/abstractions/createAbstraction.js";
2-
import { CliCommand } from "~/abstractions/index.js";
2+
import { CliCommandFactory } from "~/abstractions/index.js";
33

44
export interface ICommandsRegistryService {
5-
execute(): CliCommand.Interface<any>[];
5+
execute(): CliCommandFactory.Interface<any>[];
66
}
77

88
export const CommandsRegistryService =

packages/cli-core/src/decorators/CommandsWithGracefulErrorHandling.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { CliCommand, ErrorHandler } from "~/abstractions/index.js";
1+
import { CliCommandFactory, ErrorHandler } from "~/abstractions/index.js";
22
import { GracefulError } from "@webiny/project";
33

4-
export class CommandsWithGracefulErrorHandling<TParams> implements CliCommand.Interface<TParams> {
4+
export class CommandsWithGracefulErrorHandling<TParams>
5+
implements CliCommandFactory.Interface<TParams>
6+
{
57
constructor(
68
private gracefulErrorHandlers: ErrorHandler.Interface<TParams>[],
7-
private decoratee: CliCommand.Interface<TParams>
9+
private decoratee: CliCommandFactory.Interface<TParams>
810
) {}
911

1012
async execute() {
@@ -36,7 +38,7 @@ export class CommandsWithGracefulErrorHandling<TParams> implements CliCommand.In
3638
}
3739
}
3840

39-
export const commandsWithGracefulErrorHandling = CliCommand.createDecorator({
41+
export const commandsWithGracefulErrorHandling = CliCommandFactory.createDecorator({
4042
decorator: CommandsWithGracefulErrorHandling,
4143
dependencies: [[ErrorHandler, { multiple: true }]]
4244
});

packages/cli-core/src/decorators/DeployCommandWithTelemetry.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import {
22
isEnabled as globalIsTelemetryEnabled,
33
sendEvent as telemetrySendEvent
44
} from "@webiny/telemetry/cli.js";
5-
import { CliCommand, GetProjectSdkService } from "~/abstractions/index.js";
5+
import { CliCommandFactory, GetProjectSdkService } from "~/abstractions/index.js";
66
import { IDeployCommandParams } from "~/features/index.js";
77
import { GracefulError } from "@webiny/project";
88

99
const isDeployCommand = (
10-
command: CliCommand.CommandDefinition<any>
11-
): command is CliCommand.CommandDefinition<IDeployCommandParams> => {
10+
command: CliCommandFactory.CommandDefinition<any>
11+
): command is CliCommandFactory.CommandDefinition<IDeployCommandParams> => {
1212
return command.name === "deploy";
1313
};
1414

15-
export class DeployCommandWithTelemetry<TParams> implements CliCommand.Interface<TParams> {
15+
export class DeployCommandWithTelemetry<TParams> implements CliCommandFactory.Interface<TParams> {
1616
constructor(
1717
private getProjectSdkService: GetProjectSdkService.Interface,
18-
private decoratee: CliCommand.Interface<TParams>
18+
private decoratee: CliCommandFactory.Interface<TParams>
1919
) {}
2020

2121
async execute() {
@@ -38,7 +38,7 @@ export class DeployCommandWithTelemetry<TParams> implements CliCommand.Interface
3838
}
3939

4040
// Getting a different type without type assertion. :|
41-
const deployCommand = command as CliCommand.CommandDefinition<IDeployCommandParams>;
41+
const deployCommand = command as CliCommandFactory.CommandDefinition<IDeployCommandParams>;
4242
const originalCommandHandler = deployCommand.handler;
4343

4444
deployCommand.handler = async (params: IDeployCommandParams) => {
@@ -114,7 +114,7 @@ export class DeployCommandWithTelemetry<TParams> implements CliCommand.Interface
114114
}
115115
}
116116

117-
export const deployCommandWithTelemetry = CliCommand.createDecorator({
117+
export const deployCommandWithTelemetry = CliCommandFactory.createDecorator({
118118
decorator: DeployCommandWithTelemetry,
119119
dependencies: [GetProjectSdkService]
120120
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineExtension, zodPathToAbstraction } from "@webiny/project/extensions/index.js";
2-
import { CliCommand as CliCommandAbstraction } from "~/abstractions/index.js";
2+
import { CliCommandFactory as CliCommandFactoryAbstraction } from "~/abstractions/index.js";
33
import { z } from "zod";
44

55
export const CliCommand = defineExtension({
@@ -9,7 +9,7 @@ export const CliCommand = defineExtension({
99
multiple: true,
1010
paramsSchema: ({ project }) => {
1111
return z.object({
12-
src: zodPathToAbstraction(CliCommandAbstraction, project)
12+
src: zodPathToAbstraction(CliCommandFactoryAbstraction, project)
1313
});
1414
}
1515
});
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineExtension, zodPathToAbstraction } from "@webiny/project/extensions/index.js";
2-
import { CliCommand as CliCommandAbstraction } from "~/abstractions/index.js";
2+
import { CliCommandFactory as CliCommandFactoryAbstraction } from "~/abstractions/index.js";
33
import { z } from "zod";
44

55
export const CliCommandDecorator = defineExtension({
@@ -9,7 +9,7 @@ export const CliCommandDecorator = defineExtension({
99
multiple: true,
1010
paramsSchema: ({ project }) => {
1111
return z.object({
12-
src: zodPathToAbstraction(CliCommandAbstraction, project)
12+
src: zodPathToAbstraction(CliCommandFactoryAbstraction, project)
1313
});
1414
}
1515
});

0 commit comments

Comments
 (0)