@webiny/cli-core 0.0.0-unstable.6844005670 → 0.0.0-unstable.7be00a75a9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cli.js +12 -11
- package/Cli.js.map +1 -1
- package/abstractions/createAbstraction.js +3 -2
- package/abstractions/createAbstraction.js.map +1 -1
- package/abstractions/features/CliCommand.d.ts +3 -0
- package/abstractions/features/CliCommand.js +2 -1
- package/abstractions/features/CliCommand.js.map +1 -1
- package/abstractions/features/ErrorHandler.js +2 -1
- package/abstractions/features/ErrorHandler.js.map +1 -1
- package/abstractions/features/GlobalCliOption.js +2 -1
- package/abstractions/features/GlobalCliOption.js.map +1 -1
- package/abstractions/features/IsCi.js +2 -1
- package/abstractions/features/IsCi.js.map +1 -1
- package/abstractions/features/index.js +0 -2
- package/abstractions/features/types.js +0 -3
- package/abstractions/index.js +0 -2
- package/abstractions/services/ArgvParserService.js +2 -1
- package/abstractions/services/ArgvParserService.js.map +1 -1
- package/abstractions/services/CliParamsService.js +2 -1
- package/abstractions/services/CliParamsService.js.map +1 -1
- package/abstractions/services/CommandsRegistryService.js +2 -1
- package/abstractions/services/CommandsRegistryService.js.map +1 -1
- package/abstractions/services/GetArgvService.js +2 -1
- package/abstractions/services/GetArgvService.js.map +1 -1
- package/abstractions/services/GetCliRunnerService.js +2 -1
- package/abstractions/services/GetCliRunnerService.js.map +1 -1
- package/abstractions/services/GetIsCiService.js +2 -1
- package/abstractions/services/GetIsCiService.js.map +1 -1
- package/abstractions/services/GetProjectSdkService.js +2 -1
- package/abstractions/services/GetProjectSdkService.js.map +1 -1
- package/abstractions/services/GlobalOptionsRegistryService.js +2 -1
- package/abstractions/services/GlobalOptionsRegistryService.js.map +1 -1
- package/abstractions/services/LoggerService.js +2 -1
- package/abstractions/services/LoggerService.js.map +1 -1
- package/abstractions/services/RunCliRunnerService.js +2 -1
- package/abstractions/services/RunCliRunnerService.js.map +1 -1
- package/abstractions/services/StdioService.js +2 -1
- package/abstractions/services/StdioService.js.map +1 -1
- package/abstractions/services/UiService.js +2 -1
- package/abstractions/services/UiService.js.map +1 -1
- package/abstractions/services/index.js +0 -2
- package/createCliContainer.js +89 -118
- package/createCliContainer.js.map +1 -1
- package/decorators/CommandsWithGracefulErrorHandling.js +34 -32
- package/decorators/CommandsWithGracefulErrorHandling.js.map +1 -1
- package/decorators/DeployCommandWithTelemetry.js +72 -82
- package/decorators/DeployCommandWithTelemetry.js.map +1 -1
- package/decorators/index.js +0 -2
- package/exports/cli/command.js +0 -2
- package/exports/cli.d.ts +2 -0
- package/exports/cli.js +2 -0
- package/extensions/CliCommand.d.ts +3 -7
- package/extensions/CliCommand.js +15 -18
- package/extensions/CliCommand.js.map +1 -1
- package/extensions/CliCommandDecorator.d.ts +3 -7
- package/extensions/CliCommandDecorator.js +15 -18
- package/extensions/CliCommandDecorator.js.map +1 -1
- package/extensions/index.d.ts +2 -6
- package/extensions/index.js +5 -2
- package/extensions/index.js.map +1 -1
- package/features/AboutCommand.js +80 -86
- package/features/AboutCommand.js.map +1 -1
- package/features/BuildCommand/BuildCommand.js +46 -36
- package/features/BuildCommand/BuildCommand.js.map +1 -1
- package/features/BuildCommand/buildRunners/BaseBuildRunner.js +10 -13
- package/features/BuildCommand/buildRunners/BaseBuildRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/BuildRunner.js +18 -21
- package/features/BuildCommand/buildRunners/BuildRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/MultipleBuildsRunner.js +20 -19
- package/features/BuildCommand/buildRunners/MultipleBuildsRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/SingleBuildRunner.js +15 -14
- package/features/BuildCommand/buildRunners/SingleBuildRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/ZeroBuildsRunner.js +3 -4
- package/features/BuildCommand/buildRunners/ZeroBuildsRunner.js.map +1 -1
- package/features/BuildCommand/index.js +0 -2
- package/features/ConfigCommand.js +55 -56
- package/features/ConfigCommand.js.map +1 -1
- package/features/DeployCommand/DeployCommand.d.ts +1 -1
- package/features/DeployCommand/DeployCommand.js +164 -156
- package/features/DeployCommand/DeployCommand.js.map +1 -1
- package/features/DeployCommand/deployOutputs/BaseDeployOutput.js +12 -17
- package/features/DeployCommand/deployOutputs/BaseDeployOutput.js.map +1 -1
- package/features/DeployCommand/deployOutputs/DeployOutput.js +16 -17
- package/features/DeployCommand/deployOutputs/DeployOutput.js.map +1 -1
- package/features/DeployCommand/deployOutputs/NoDeploymentLogsDeployOutput.js +89 -54
- package/features/DeployCommand/deployOutputs/NoDeploymentLogsDeployOutput.js.map +1 -1
- package/features/DeployCommand/deployOutputs/WithDeploymentLogsDeployOutput.js +24 -37
- package/features/DeployCommand/deployOutputs/WithDeploymentLogsDeployOutput.js.map +1 -1
- package/features/DeployCommand/index.js +0 -2
- package/features/DepsSync/BuildDependencyTree.js +16 -21
- package/features/DepsSync/BuildDependencyTree.js.map +1 -1
- package/features/DepsSync/DependencyTree.js +108 -119
- package/features/DepsSync/DependencyTree.js.map +1 -1
- package/features/DepsSync/ListAllPackageJsonFiles.js +19 -14
- package/features/DepsSync/ListAllPackageJsonFiles.js.map +1 -1
- package/features/DepsSync/ListAllPackages.js +7 -9
- package/features/DepsSync/ListAllPackages.js.map +1 -1
- package/features/DepsSync/commands/SyncDepsCommand.js +30 -24
- package/features/DepsSync/commands/SyncDepsCommand.js.map +1 -1
- package/features/DepsSync/commands/VerifyDepsCommand.js +69 -70
- package/features/DepsSync/commands/VerifyDepsCommand.js.map +1 -1
- package/features/DepsSync/createDependencyTree.js +25 -18
- package/features/DepsSync/createDependencyTree.js.map +1 -1
- package/features/DepsSync/createReferenceFile.js +21 -25
- package/features/DepsSync/createReferenceFile.js.map +1 -1
- package/features/DepsSync/index.js +0 -2
- package/features/DepsSync/paths.js +3 -6
- package/features/DepsSync/paths.js.map +1 -1
- package/features/DepsSync/types.js +7 -6
- package/features/DepsSync/types.js.map +1 -1
- package/features/DestroyCommand/DestroyCommand.js +71 -67
- package/features/DestroyCommand/DestroyCommand.js.map +1 -1
- package/features/DestroyCommand/index.js +0 -2
- package/features/DisableTelemetryCommand.js +28 -25
- package/features/DisableTelemetryCommand.js.map +1 -1
- package/features/EnableTelemetryCommand.js +28 -25
- package/features/EnableTelemetryCommand.js.map +1 -1
- package/features/ExtensionCommand/ExtensionCommand.js +60 -63
- package/features/ExtensionCommand/ExtensionCommand.js.map +1 -1
- package/features/ExtensionCommand/index.js +0 -2
- package/features/InfoCommand/InfoCommand.js +54 -56
- package/features/InfoCommand/InfoCommand.js.map +1 -1
- package/features/InfoCommand/PrintInfoForEnv.js +31 -47
- package/features/InfoCommand/PrintInfoForEnv.js.map +1 -1
- package/features/InfoCommand/index.js +0 -2
- package/features/IsCi/IsCi.js +14 -11
- package/features/IsCi/IsCi.js.map +1 -1
- package/features/IsCi/index.js +1 -3
- package/features/OpenCommand.js +48 -47
- package/features/OpenCommand.js.map +1 -1
- package/features/OutputCommand.js +56 -69
- package/features/OutputCommand.js.map +1 -1
- package/features/PulumiCommand/PulumiCommand.js +48 -41
- package/features/PulumiCommand/PulumiCommand.js.map +1 -1
- package/features/PulumiCommand/index.js +0 -2
- package/features/RefreshCommand/RefreshCommand.js +42 -36
- package/features/RefreshCommand/RefreshCommand.js.map +1 -1
- package/features/RefreshCommand/index.js +0 -2
- package/features/UpgradeCommand/UpgradeCommand.d.ts +29 -0
- package/features/UpgradeCommand/UpgradeCommand.js +123 -0
- package/features/UpgradeCommand/UpgradeCommand.js.map +1 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.d.ts +11 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.js +102 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.js.map +1 -0
- package/features/UpgradeCommand/abstraction.d.ts +23 -0
- package/features/UpgradeCommand/abstraction.js +5 -0
- package/features/UpgradeCommand/abstraction.js.map +1 -0
- package/features/UpgradeCommand/feature.d.ts +4 -0
- package/features/UpgradeCommand/feature.js +13 -0
- package/features/UpgradeCommand/feature.js.map +1 -0
- package/features/UpgradeCommand/index.d.ts +2 -0
- package/features/UpgradeCommand/index.js +2 -0
- package/features/WatchCommand/WatchCommand.js +131 -131
- package/features/WatchCommand/WatchCommand.js.map +1 -1
- package/features/WatchCommand/createPrefixer.js +11 -15
- package/features/WatchCommand/createPrefixer.js.map +1 -1
- package/features/WatchCommand/getRandomColorForString.js +86 -8
- package/features/WatchCommand/getRandomColorForString.js.map +1 -1
- package/features/WatchCommand/index.js +0 -2
- package/features/Wcp/LinkProjectCommand.js +119 -138
- package/features/Wcp/LinkProjectCommand.js.map +1 -1
- package/features/Wcp/LoginCommand.js +104 -118
- package/features/Wcp/LoginCommand.js.map +1 -1
- package/features/Wcp/LogoutCommand.js +29 -23
- package/features/Wcp/LogoutCommand.js.map +1 -1
- package/features/Wcp/WhoAmICommand.js +33 -29
- package/features/Wcp/WhoAmICommand.js.map +1 -1
- package/features/common/index.js +0 -2
- package/features/common/options.js +41 -50
- package/features/common/options.js.map +1 -1
- package/features/globalOptions/LogLevelGlobalOption.js +25 -16
- package/features/globalOptions/LogLevelGlobalOption.js.map +1 -1
- package/features/globalOptions/ShowLogsGlobalOption.js +16 -15
- package/features/globalOptions/ShowLogsGlobalOption.js.map +1 -1
- package/features/globalOptions/StackTraceGlobalOption.js +16 -15
- package/features/globalOptions/StackTraceGlobalOption.js.map +1 -1
- package/features/globalOptions/index.js +0 -2
- package/features/gracefulErrorHandlers/DdbPutItemConditionalCheckFailedGracefulErrorHandler.js +17 -16
- package/features/gracefulErrorHandlers/DdbPutItemConditionalCheckFailedGracefulErrorHandler.js.map +1 -1
- package/features/gracefulErrorHandlers/MissingFilesInBuildGracefulErrorHandler.js +12 -18
- package/features/gracefulErrorHandlers/MissingFilesInBuildGracefulErrorHandler.js.map +1 -1
- package/features/gracefulErrorHandlers/PendingOperationsGracefulErrorHandler.js +19 -19
- package/features/gracefulErrorHandlers/PendingOperationsGracefulErrorHandler.js.map +1 -1
- package/features/gracefulErrorHandlers/index.js +0 -2
- package/features/index.d.ts +1 -0
- package/features/index.js +1 -2
- package/features/utils/index.js +0 -2
- package/features/utils/measureDuration.js +7 -8
- package/features/utils/measureDuration.js.map +1 -1
- package/index.js +0 -2
- package/package.json +29 -24
- package/services/ArgvParserService/ArgvParserService.js +27 -33
- package/services/ArgvParserService/ArgvParserService.js.map +1 -1
- package/services/ArgvParserService/index.js +0 -2
- package/services/CliParamsService/CliParamsService.js +18 -15
- package/services/CliParamsService/CliParamsService.js.map +1 -1
- package/services/CliParamsService/index.js +0 -2
- package/services/CommandsRegistryService/CommandsRegistryService.js +19 -13
- package/services/CommandsRegistryService/CommandsRegistryService.js.map +1 -1
- package/services/CommandsRegistryService/index.js +0 -2
- package/services/GetArgvService/GetArgvService.js +14 -11
- package/services/GetArgvService/GetArgvService.js.map +1 -1
- package/services/GetArgvService/index.js +0 -2
- package/services/GetCliRunnerService/GetCliRunnerService.js +119 -148
- package/services/GetCliRunnerService/GetCliRunnerService.js.map +1 -1
- package/services/GetCliRunnerService/index.js +0 -2
- package/services/GetIsCiService/GetIsCiService.js +9 -8
- package/services/GetIsCiService/GetIsCiService.js.map +1 -1
- package/services/GetIsCiService/index.js +1 -3
- package/services/GetProjectSdkService/GetProjectSdkService.js +25 -24
- package/services/GetProjectSdkService/GetProjectSdkService.js.map +1 -1
- package/services/GetProjectSdkService/index.js +0 -2
- package/services/GlobalOptionsRegistryService/GlobalOptionsRegistryService.js +19 -13
- package/services/GlobalOptionsRegistryService/GlobalOptionsRegistryService.js.map +1 -1
- package/services/GlobalOptionsRegistryService/index.js +0 -2
- package/services/LoggerService/LoggerService.js +76 -88
- package/services/LoggerService/LoggerService.js.map +1 -1
- package/services/LoggerService/index.js +0 -2
- package/services/RunCliRunnerService/RunCliRunnerService.js +15 -13
- package/services/RunCliRunnerService/RunCliRunnerService.js.map +1 -1
- package/services/RunCliRunnerService/index.js +0 -2
- package/services/StdioService/StdioService.js +15 -14
- package/services/StdioService/StdioService.js.map +1 -1
- package/services/StdioService/index.js +0 -2
- package/services/UiService/UiService.js +55 -58
- package/services/UiService/UiService.js.map +1 -1
- package/services/UiService/index.js +0 -2
- package/services/index.js +0 -2
- package/utils/ManuallyReportedError.js +7 -6
- package/utils/ManuallyReportedError.js.map +1 -1
- package/abstractions/features/index.js.map +0 -1
- package/abstractions/features/types.js.map +0 -1
- package/abstractions/index.js.map +0 -1
- package/abstractions/services/index.js.map +0 -1
- package/decorators/index.js.map +0 -1
- package/exports/cli/command.js.map +0 -1
- package/exports/cli/index.d.ts +0 -2
- package/exports/cli/index.js +0 -4
- package/exports/cli/index.js.map +0 -1
- package/features/BuildCommand/index.js.map +0 -1
- package/features/DeployCommand/index.js.map +0 -1
- package/features/DepsSync/index.js.map +0 -1
- package/features/DestroyCommand/index.js.map +0 -1
- package/features/ExtensionCommand/index.js.map +0 -1
- package/features/InfoCommand/index.js.map +0 -1
- package/features/IsCi/index.js.map +0 -1
- package/features/PulumiCommand/index.js.map +0 -1
- package/features/RefreshCommand/index.js.map +0 -1
- package/features/WatchCommand/index.js.map +0 -1
- package/features/common/index.js.map +0 -1
- package/features/globalOptions/index.js.map +0 -1
- package/features/gracefulErrorHandlers/index.js.map +0 -1
- package/features/index.js.map +0 -1
- package/features/utils/index.js.map +0 -1
- package/index.js.map +0 -1
- package/services/ArgvParserService/index.js.map +0 -1
- package/services/CliParamsService/index.js.map +0 -1
- package/services/CommandsRegistryService/index.js.map +0 -1
- package/services/GetArgvService/index.js.map +0 -1
- package/services/GetCliRunnerService/index.js.map +0 -1
- package/services/GetIsCiService/index.js.map +0 -1
- package/services/GetProjectSdkService/index.js.map +0 -1
- package/services/GlobalOptionsRegistryService/index.js.map +0 -1
- package/services/LoggerService/index.js.map +0 -1
- package/services/RunCliRunnerService/index.js.map +0 -1
- package/services/StdioService/index.js.map +0 -1
- package/services/UiService/index.js.map +0 -1
- package/services/index.js.map +0 -1
package/Cli.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createCliContainer } from "./createCliContainer.js";
|
|
2
2
|
import { RunCliRunnerService } from "./abstractions/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
class Cli {
|
|
4
|
+
constructor(container){
|
|
5
|
+
this.container = container;
|
|
6
|
+
}
|
|
7
|
+
run() {
|
|
8
|
+
return this.container.resolve(RunCliRunnerService).execute();
|
|
9
|
+
}
|
|
10
|
+
static async init(params = {}) {
|
|
11
|
+
const container = await createCliContainer(params);
|
|
12
|
+
return new Cli(container);
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
|
+
export { Cli };
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=Cli.js.map
|
package/Cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Cli.js","sources":["../src/Cli.ts"],"sourcesContent":["import { Container } from \"@webiny/di\";\nimport { createCliContainer } from \"./createCliContainer.js\";\nimport { CliParamsService, RunCliRunnerService } from \"~/abstractions/index.js\";\n\nexport class Cli {\n private container: Container;\n\n private constructor(container: Container) {\n this.container = container;\n }\n\n run() {\n return this.container.resolve(RunCliRunnerService).execute();\n }\n\n static async init(params: CliParamsService.Params = {}) {\n const container = await createCliContainer(params);\n return new Cli(container);\n }\n}\n"],"names":["Cli","container","RunCliRunnerService","params","createCliContainer"],"mappings":";;AAIO,MAAMA;IAGT,YAAoBC,SAAoB,CAAE;QACtC,IAAI,CAAC,SAAS,GAAGA;IACrB;IAEA,MAAM;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAACC,qBAAqB,OAAO;IAC9D;IAEA,aAAa,KAAKC,SAAkC,CAAC,CAAC,EAAE;QACpD,MAAMF,YAAY,MAAMG,mBAAmBD;QAC3C,OAAO,IAAIH,IAAIC;IACnB;AACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Abstraction } from "@webiny/di";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
function createAbstraction(name) {
|
|
3
|
+
return new Abstraction(name);
|
|
4
4
|
}
|
|
5
|
+
export { createAbstraction };
|
|
5
6
|
|
|
6
7
|
//# sourceMappingURL=createAbstraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/createAbstraction.js","sources":["../../src/abstractions/createAbstraction.ts"],"sourcesContent":["import { Abstraction } from \"@webiny/di\";\n\nexport function createAbstraction<T>(name: string): Abstraction<T> {\n return new Abstraction<T>(name);\n}\n"],"names":["createAbstraction","name","Abstraction"],"mappings":";AAEO,SAASA,kBAAqBC,IAAY;IAC7C,OAAO,IAAIC,YAAeD;AAC9B"}
|
|
@@ -29,6 +29,9 @@ export interface ICliCommandDefinition<TCommandParams> {
|
|
|
29
29
|
export interface ICliCommand<TCommandParams> {
|
|
30
30
|
execute(): Promise<ICliCommandDefinition<TCommandParams>> | ICliCommandDefinition<TCommandParams>;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Implement a custom CLI command for Webiny CLI.
|
|
34
|
+
*/
|
|
32
35
|
export declare const CliCommandFactory: import("@webiny/di").Abstraction<ICliCommand<any>>;
|
|
33
36
|
export declare namespace CliCommandFactory {
|
|
34
37
|
type Interface<TCommandParams> = ICliCommand<TCommandParams>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const CliCommandFactory = createAbstraction("CliCommandFactory");
|
|
3
|
+
export { CliCommandFactory };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=CliCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/features/CliCommand.js","sources":["../../../src/abstractions/features/CliCommand.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface ICliCommandParamDefinition<TCommandParams> {\n name: string;\n description: string;\n type: \"boolean\" | \"number\" | \"string\";\n required?: boolean;\n array?: boolean;\n default?: any;\n validation?: (value: TCommandParams) => boolean | string;\n}\n\nexport interface ICliCommandOptionDefinition<TCommandParams> {\n name: string;\n description: string;\n type: \"boolean\" | \"number\" | \"string\";\n group?: string;\n required?: boolean;\n alias?: string;\n array?: boolean;\n default?: any;\n validation?: (value: TCommandParams) => boolean | string;\n}\n\nexport interface ICliCommandDefinition<TCommandParams> {\n name: string;\n description: string;\n params?: ICliCommandParamDefinition<TCommandParams>[];\n options?: ICliCommandOptionDefinition<TCommandParams>[];\n examples?: string[];\n handler: (params: TCommandParams) => void | Promise<void>;\n}\n\nexport interface ICliCommand<TCommandParams> {\n execute():\n | Promise<ICliCommandDefinition<TCommandParams>>\n | ICliCommandDefinition<TCommandParams>;\n}\n\n/**\n * Implement a custom CLI command for Webiny CLI.\n */\nexport const CliCommandFactory = createAbstraction<ICliCommand<any>>(\"CliCommandFactory\");\n\nexport namespace CliCommandFactory {\n export type Interface<TCommandParams> = ICliCommand<TCommandParams>;\n\n export type ParamDefinition<TCommandParams> = ICliCommandParamDefinition<TCommandParams>;\n export type OptionDefinition<TCommandParams> = ICliCommandOptionDefinition<TCommandParams>;\n\n export type CommandDefinition<TCommandParams> = ICliCommandDefinition<TCommandParams>;\n}\n"],"names":["CliCommandFactory","createAbstraction"],"mappings":";AA0CO,MAAMA,oBAAoBC,kBAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/features/ErrorHandler.js","sources":["../../../src/abstractions/features/ErrorHandler.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\nimport { CliCommandFactory } from \"~/abstractions/index.js\";\n\nexport type IError = Error;\n\nexport interface IErrorHandlerParams<TParams> {\n error: Error;\n command: CliCommandFactory.CommandDefinition<any>;\n params: TParams;\n}\n\nexport interface IErrorHandler<TParams> {\n execute(params: IErrorHandlerParams<TParams>): void;\n}\n\nexport const ErrorHandler = createAbstraction<IErrorHandler<any>>(\"ErrorHandler\");\n\nexport namespace ErrorHandler {\n export type Interface<TParams> = IErrorHandler<TParams>;\n export type Params<TParams> = IErrorHandlerParams<TParams>;\n}\n"],"names":["ErrorHandler","createAbstraction"],"mappings":";AAeO,MAAMA,eAAeC,kBAAsC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const GlobalCliOption = createAbstraction("GlobalCliOption");
|
|
3
|
+
export { GlobalCliOption };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=GlobalCliOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/features/GlobalCliOption.js","sources":["../../../src/abstractions/features/GlobalCliOption.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface IGlobalCliOptionConfig {\n type: \"boolean\" | \"number\" | \"string\";\n description: string;\n default?: any;\n alias?: string;\n choices?: string[];\n}\n\nexport interface IGlobalCliOptionDefinition {\n name: string;\n config: IGlobalCliOptionConfig;\n}\n\nexport interface IGlobalCliOption {\n execute(): Promise<IGlobalCliOptionDefinition> | IGlobalCliOptionDefinition;\n}\n\nexport const GlobalCliOption = createAbstraction<IGlobalCliOption>(\"GlobalCliOption\");\n\nexport namespace GlobalCliOption {\n export type Interface = IGlobalCliOption;\n export type Definition = IGlobalCliOptionDefinition;\n export type Config = IGlobalCliOptionConfig;\n}\n"],"names":["GlobalCliOption","createAbstraction"],"mappings":";AAmBO,MAAMA,kBAAkBC,kBAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/features/IsCi.js","sources":["../../../src/abstractions/features/IsCi.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\ninterface IIsCi {\n execute(): boolean;\n}\n\nexport const IsCi = createAbstraction<IIsCi>(\"IsCi\");\n\nexport namespace IsCi {\n export type Interface = IIsCi;\n}\n"],"names":["IsCi","createAbstraction"],"mappings":";AAMO,MAAMA,OAAOC,kBAAyB"}
|
package/abstractions/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const ArgvParserService = createAbstraction("ArgvParserService");
|
|
3
|
+
export { ArgvParserService };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=ArgvParserService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/ArgvParserService.js","sources":["../../../src/abstractions/services/ArgvParserService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface IArgvParserService {\n parse<T = Record<string, any>>(argv: string[]): T;\n}\n\nexport const ArgvParserService = createAbstraction<IArgvParserService>(\"ArgvParserService\");\n\nexport namespace ArgvParserService {\n export type Interface = IArgvParserService;\n}\n"],"names":["ArgvParserService","createAbstraction"],"mappings":";AAMO,MAAMA,oBAAoBC,kBAAsC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/CliParamsService.js","sources":["../../../src/abstractions/services/CliParamsService.ts"],"sourcesContent":["import { ExtensionDefinitionModel } from \"@webiny/project/extensions/index.js\";\nimport { Abstraction } from \"@webiny/di\";\n\nexport interface ICliParams {\n cwd?: string;\n extensions?: ExtensionDefinitionModel<any>[];\n}\n\nexport interface ICliParamsService {\n get(): ICliParams;\n set(params: ICliParams): void;\n}\n\nexport const CliParamsService = new Abstraction<ICliParamsService>(\"CliParamsService\");\n\nexport namespace CliParamsService {\n export type Interface = ICliParamsService;\n export type Params = ICliParams;\n}\n"],"names":["CliParamsService","Abstraction"],"mappings":";AAaO,MAAMA,mBAAmB,IAAIC,YAA+B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const CommandsRegistryService = createAbstraction("CommandsRegistryService");
|
|
3
|
+
export { CommandsRegistryService };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=CommandsRegistryService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/CommandsRegistryService.js","sources":["../../../src/abstractions/services/CommandsRegistryService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\nimport { CliCommandFactory } from \"~/abstractions/index.js\";\n\nexport interface ICommandsRegistryService {\n execute(): CliCommandFactory.Interface<any>[];\n}\n\nexport const CommandsRegistryService =\n createAbstraction<ICommandsRegistryService>(\"CommandsRegistryService\");\n\nexport namespace CommandsRegistryService {\n export type Interface = ICommandsRegistryService;\n}\n"],"names":["CommandsRegistryService","createAbstraction"],"mappings":";AAOO,MAAMA,0BACTC,kBAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/GetArgvService.js","sources":["../../../src/abstractions/services/GetArgvService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface IGetArgvService {\n execute<T = Record<string, any>>(): T;\n}\n\nexport const GetArgvService = createAbstraction<IGetArgvService>(\"GetArgvService\");\n\nexport namespace GetArgvService {\n export type Interface = IGetArgvService;\n}\n"],"names":["GetArgvService","createAbstraction"],"mappings":";AAMO,MAAMA,iBAAiBC,kBAAmC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const GetCliRunnerService = createAbstraction("GetCliRunnerService");
|
|
3
|
+
export { GetCliRunnerService };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=GetCliRunnerService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/GetCliRunnerService.js","sources":["../../../src/abstractions/services/GetCliRunnerService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface IGetCliRunnerService {\n execute(): Promise<any>;\n}\n\nexport const GetCliRunnerService = createAbstraction<IGetCliRunnerService>(\"GetCliRunnerService\");\n\nexport namespace GetCliRunnerService {\n export type Interface = IGetCliRunnerService;\n}\n"],"names":["GetCliRunnerService","createAbstraction"],"mappings":";AAMO,MAAMA,sBAAsBC,kBAAwC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/GetIsCiService.js","sources":["../../../src/abstractions/services/GetIsCiService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\ninterface IGetIsCiService {\n execute(): boolean;\n}\n\nexport const GetIsCiService = createAbstraction<IGetIsCiService>(\"GetIsCiService\");\n\nexport namespace GetIsCiService {\n export type Interface = IGetIsCiService;\n}\n"],"names":["GetIsCiService","createAbstraction"],"mappings":";AAMO,MAAMA,iBAAiBC,kBAAmC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const GetProjectSdkService = createAbstraction("GetProjectSdkService");
|
|
3
|
+
export { GetProjectSdkService };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=GetProjectSdkService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/GetProjectSdkService.js","sources":["../../../src/abstractions/services/GetProjectSdkService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\nimport { type ProjectSdk } from \"@webiny/project\";\n\nexport interface IGetProjectSdkService {\n execute(): Promise<ProjectSdk>;\n}\n\nexport const GetProjectSdkService =\n createAbstraction<IGetProjectSdkService>(\"GetProjectSdkService\");\n\nexport namespace GetProjectSdkService {\n export type Interface = IGetProjectSdkService;\n}\n"],"names":["GetProjectSdkService","createAbstraction"],"mappings":";AAOO,MAAMA,uBACTC,kBAAyC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const GlobalOptionsRegistryService = createAbstraction("GlobalOptionsRegistryService");
|
|
3
|
+
export { GlobalOptionsRegistryService };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=GlobalOptionsRegistryService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/GlobalOptionsRegistryService.js","sources":["../../../src/abstractions/services/GlobalOptionsRegistryService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\nimport { GlobalCliOption } from \"~/abstractions/index.js\";\n\nexport interface IGlobalOptionsRegistryService {\n execute(): GlobalCliOption.Interface[];\n}\n\nexport const GlobalOptionsRegistryService = createAbstraction<IGlobalOptionsRegistryService>(\n \"GlobalOptionsRegistryService\"\n);\n\nexport namespace GlobalOptionsRegistryService {\n export type Interface = IGlobalOptionsRegistryService;\n}\n"],"names":["GlobalOptionsRegistryService","createAbstraction"],"mappings":";AAOO,MAAMA,+BAA+BC,kBACxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/LoggerService.js","sources":["../../../src/abstractions/services/LoggerService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface ILoggerService {\n // Basic levels\n trace(objOrMsg: object | string, ...args: any[]): void;\n debug(objOrMsg: object | string, ...args: any[]): void;\n info(objOrMsg: object | string, ...args: any[]): void;\n warn(objOrMsg: object | string, ...args: any[]): void;\n error(objOrMsg: object | string, ...args: any[]): void;\n fatal(objOrMsg: object | string, ...args: any[]): void;\n\n // Generic log (can default to 'info')\n log(objOrMsg: object | string, ...args: any[]): void;\n}\n\nexport const LoggerService = createAbstraction<ILoggerService>(\"LoggerService\");\n\nexport namespace LoggerService {\n export type Interface = ILoggerService;\n}\n"],"names":["LoggerService","createAbstraction"],"mappings":";AAeO,MAAMA,gBAAgBC,kBAAkC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createAbstraction } from "../createAbstraction.js";
|
|
2
|
-
|
|
2
|
+
const RunCliRunnerService = createAbstraction("RunCliRunnerService");
|
|
3
|
+
export { RunCliRunnerService };
|
|
3
4
|
|
|
4
5
|
//# sourceMappingURL=RunCliRunnerService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/RunCliRunnerService.js","sources":["../../../src/abstractions/services/RunCliRunnerService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface IRunCliRunnerService {\n execute(): any;\n}\n\nexport const RunCliRunnerService = createAbstraction<IRunCliRunnerService>(\"RunCliRunnerService\");\n\nexport namespace RunCliRunnerService {\n export type Interface = IRunCliRunnerService;\n}\n"],"names":["RunCliRunnerService","createAbstraction"],"mappings":";AAMO,MAAMA,sBAAsBC,kBAAwC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/StdioService.js","sources":["../../../src/abstractions/services/StdioService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface IStdioService {\n getStdout(): NodeJS.WriteStream;\n\n getStderr(): NodeJS.WriteStream;\n\n getStdin(): NodeJS.ReadStream;\n}\n\nexport const StdioService = createAbstraction<IStdioService>(\"StdioService\");\n\nexport namespace StdioService {\n export type Interface = IStdioService;\n}\n"],"names":["StdioService","createAbstraction"],"mappings":";AAUO,MAAMA,eAAeC,kBAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"abstractions/services/UiService.js","sources":["../../../src/abstractions/services/UiService.ts"],"sourcesContent":["import { createAbstraction } from \"~/abstractions/createAbstraction.js\";\n\nexport interface IUiService {\n raw(text: string): void;\n\n text(text: string): void;\n\n textBold(text: string): void;\n\n emptyLine(): void;\n\n info(text: string, ...args: any[]): void;\n\n success(text: string, ...args: any[]): void;\n\n error(text: string, ...args: any[]): void;\n\n warning(text: string, ...args: any[]): void;\n\n debug(text: string, ...args: any[]): void;\n}\n\nexport const UiService = createAbstraction<IUiService>(\"UiService\");\n\nexport namespace UiService {\n export type Interface = IUiService;\n}\n"],"names":["UiService","createAbstraction"],"mappings":";AAsBO,MAAMA,YAAYC,kBAA8B"}
|
package/createCliContainer.js
CHANGED
|
@@ -1,128 +1,99 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { Container } from "@webiny/di";
|
|
3
|
-
import { argvParserService, cliParamsService, commandsRegistryService, getArgvService, getCliRunnerService, getIsCiService,
|
|
4
|
-
import { aboutCommand, buildCommand, configCommand, ddbPutItemConditionalCheckFailedGracefulErrorHandler, deployCommand, destroyCommand, disableTelemetryCommand, enableTelemetryCommand, extensionCommand, infoCommand, isCi, missingFilesInBuildGracefulErrorHandler, openCommand, outputCommand, pendingOperationsGracefulErrorHandler, pulumiCommand, refreshCommand, syncDepsCommand, verifyDepsCommand, watchCommand,
|
|
5
|
-
// WCP
|
|
6
|
-
linkProjectCommand, loginCommand, logoutCommand, whoAmICommand,
|
|
7
|
-
// Global Options
|
|
8
|
-
showLogsGlobalOption, logLevelGlobalOption, stackTraceGlobalOption } from "./features/index.js";
|
|
3
|
+
import { argvParserService, cliParamsService, commandsRegistryService, getArgvService, getCliRunnerService, getIsCiService, getProjectSdkService, globalOptionsRegistryService, loggerService, runCliRunnerService, stdioService, uiService } from "./services/index.js";
|
|
4
|
+
import { UpgradeCommandFeature, aboutCommand, buildCommand, configCommand, ddbPutItemConditionalCheckFailedGracefulErrorHandler, deployCommand, destroyCommand, disableTelemetryCommand, enableTelemetryCommand, extensionCommand, infoCommand, isCi, linkProjectCommand, logLevelGlobalOption, loginCommand, logoutCommand, missingFilesInBuildGracefulErrorHandler, openCommand, outputCommand, pendingOperationsGracefulErrorHandler, pulumiCommand, refreshCommand, showLogsGlobalOption, stackTraceGlobalOption, syncDepsCommand, verifyDepsCommand, watchCommand, whoAmICommand } from "./features/index.js";
|
|
9
5
|
import chalk from "chalk";
|
|
10
6
|
import { CliParamsService, GetArgvService, GetProjectSdkService, UiService } from "./abstractions/index.js";
|
|
11
|
-
import { GracefulError } from "@webiny/project";
|
|
7
|
+
import { GracefulError, toImportSpecifier } from "@webiny/project";
|
|
12
8
|
import { commandsWithGracefulErrorHandling, deployCommandWithTelemetry } from "./decorators/index.js";
|
|
13
9
|
import { CliCommand } from "./extensions/index.js";
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
const commands = projectConfig.extensionsByType(CliCommand);
|
|
98
|
-
for (const command of commands) {
|
|
99
|
-
const commandImplementation = await importFromPath(command.params.src);
|
|
100
|
-
container.register(commandImplementation).inSingletonScope();
|
|
101
|
-
}
|
|
102
|
-
} catch (error) {
|
|
103
|
-
let realError = error;
|
|
104
|
-
if (error.cause) {
|
|
105
|
-
realError = error.cause;
|
|
106
|
-
}
|
|
107
|
-
ui.error(realError.message);
|
|
108
|
-
const argv = container.resolve(GetArgvService).execute();
|
|
109
|
-
if (argv.showStackTrace && realError.stack) {
|
|
110
|
-
ui.emptyLine();
|
|
111
|
-
ui.debug("Stack trace:");
|
|
112
|
-
ui.text(realError.stack);
|
|
10
|
+
const { bgYellow: bgYellow, bold: bold } = chalk;
|
|
11
|
+
const createCliContainer = async (params)=>{
|
|
12
|
+
const container = new Container();
|
|
13
|
+
container.register(aboutCommand).inSingletonScope();
|
|
14
|
+
container.register(buildCommand).inSingletonScope();
|
|
15
|
+
container.register(configCommand).inSingletonScope();
|
|
16
|
+
container.register(deployCommand).inSingletonScope();
|
|
17
|
+
container.register(pulumiCommand).inSingletonScope();
|
|
18
|
+
container.register(refreshCommand).inSingletonScope();
|
|
19
|
+
container.register(enableTelemetryCommand).inSingletonScope();
|
|
20
|
+
container.register(disableTelemetryCommand).inSingletonScope();
|
|
21
|
+
container.register(extensionCommand).inSingletonScope();
|
|
22
|
+
container.register(syncDepsCommand).inSingletonScope();
|
|
23
|
+
container.register(verifyDepsCommand).inSingletonScope();
|
|
24
|
+
container.register(destroyCommand).inSingletonScope();
|
|
25
|
+
container.register(infoCommand).inSingletonScope();
|
|
26
|
+
container.register(isCi).inSingletonScope();
|
|
27
|
+
container.register(openCommand).inSingletonScope();
|
|
28
|
+
container.register(outputCommand).inSingletonScope();
|
|
29
|
+
container.register(watchCommand).inSingletonScope();
|
|
30
|
+
UpgradeCommandFeature.register(container);
|
|
31
|
+
container.register(linkProjectCommand).inSingletonScope();
|
|
32
|
+
container.register(loginCommand).inSingletonScope();
|
|
33
|
+
container.register(logoutCommand).inSingletonScope();
|
|
34
|
+
container.register(whoAmICommand).inSingletonScope();
|
|
35
|
+
container.register(ddbPutItemConditionalCheckFailedGracefulErrorHandler).inSingletonScope();
|
|
36
|
+
container.register(missingFilesInBuildGracefulErrorHandler).inSingletonScope();
|
|
37
|
+
container.register(pendingOperationsGracefulErrorHandler).inSingletonScope();
|
|
38
|
+
container.register(showLogsGlobalOption).inSingletonScope();
|
|
39
|
+
container.register(logLevelGlobalOption).inSingletonScope();
|
|
40
|
+
container.register(stackTraceGlobalOption).inSingletonScope();
|
|
41
|
+
container.register(argvParserService).inSingletonScope();
|
|
42
|
+
container.register(cliParamsService).inSingletonScope();
|
|
43
|
+
container.register(commandsRegistryService).inSingletonScope();
|
|
44
|
+
container.register(getArgvService).inSingletonScope();
|
|
45
|
+
container.register(getCliRunnerService).inSingletonScope();
|
|
46
|
+
container.register(getIsCiService).inSingletonScope();
|
|
47
|
+
container.register(globalOptionsRegistryService).inSingletonScope();
|
|
48
|
+
container.register(getProjectSdkService).inSingletonScope();
|
|
49
|
+
container.register(loggerService).inSingletonScope();
|
|
50
|
+
container.register(runCliRunnerService).inSingletonScope();
|
|
51
|
+
container.register(stdioService).inSingletonScope();
|
|
52
|
+
container.register(uiService).inSingletonScope();
|
|
53
|
+
const ui = container.resolve(UiService);
|
|
54
|
+
try {
|
|
55
|
+
container.resolve(CliParamsService).set(params);
|
|
56
|
+
const projectSdk = await container.resolve(GetProjectSdkService).execute();
|
|
57
|
+
const projectConfig = await projectSdk.getProjectConfig({
|
|
58
|
+
tags: {
|
|
59
|
+
runtimeContext: "cli"
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
await projectSdk.validateProjectConfig(projectConfig);
|
|
63
|
+
const project = projectSdk.getProject();
|
|
64
|
+
const importFromPath = async (filePath)=>{
|
|
65
|
+
let importPath;
|
|
66
|
+
importPath = filePath.startsWith("/extensions/") ? project.paths.rootFolder.join(filePath).toString() : filePath;
|
|
67
|
+
const exportName = path.basename(filePath).replace(path.extname(filePath), "");
|
|
68
|
+
const importedModule = await import(toImportSpecifier(importPath));
|
|
69
|
+
return "default" in importedModule && importedModule.default || importedModule[exportName];
|
|
70
|
+
};
|
|
71
|
+
const commands = projectConfig.extensionsByType(CliCommand);
|
|
72
|
+
for (const command of commands){
|
|
73
|
+
const commandImplementation = await importFromPath(command.params.src);
|
|
74
|
+
container.register(commandImplementation).inSingletonScope();
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
let realError = error;
|
|
78
|
+
if (error.cause) realError = error.cause;
|
|
79
|
+
ui.error(realError.message);
|
|
80
|
+
const argv = container.resolve(GetArgvService).execute();
|
|
81
|
+
if (argv.showStackTrace && realError.stack) {
|
|
82
|
+
ui.emptyLine();
|
|
83
|
+
ui.debug("Stack trace:");
|
|
84
|
+
ui.text(realError.stack);
|
|
85
|
+
}
|
|
86
|
+
if (error && error instanceof GracefulError) {
|
|
87
|
+
ui.emptyLine();
|
|
88
|
+
ui.text(bgYellow(bold("💡 How can I resolve this?")));
|
|
89
|
+
ui.text(error.message);
|
|
90
|
+
}
|
|
91
|
+
process.exit(1);
|
|
113
92
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
ui.text(error.message);
|
|
118
|
-
}
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Decorators.
|
|
123
|
-
container.registerDecorator(commandsWithGracefulErrorHandling);
|
|
124
|
-
container.registerDecorator(deployCommandWithTelemetry);
|
|
125
|
-
return container;
|
|
93
|
+
container.registerDecorator(commandsWithGracefulErrorHandling);
|
|
94
|
+
container.registerDecorator(deployCommandWithTelemetry);
|
|
95
|
+
return container;
|
|
126
96
|
};
|
|
97
|
+
export { createCliContainer };
|
|
127
98
|
|
|
128
99
|
//# sourceMappingURL=createCliContainer.js.map
|