@webiny/cli-core 0.0.0-unstable.6f45466a1d → 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 +4 -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 +17 -22
- 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 +70 -71
- 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 +22 -26
- 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 -42
- 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 +33 -28
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/OpenCommand.js","sources":["../../src/features/OpenCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { CliCommandFactory, GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\nimport { IBaseAppParams } from \"~/abstractions/features/types.js\";\nimport { createBaseAppOptions } from \"~/features/common/index.js\";\nimport open from \"open\";\n\nexport type IOpenCommandParams = Omit<IBaseAppParams, \"app\">;\n\nexport class OpenCommand implements CliCommandFactory.Interface<IOpenCommandParams> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute(): Promise<CliCommandFactory.CommandDefinition<IOpenCommandParams>> {\n const projectSdk = await this.getProjectSdkService.execute();\n const ui = this.uiService;\n\n return {\n name: \"open\",\n description: \"Quickly open Admin application in your default browser\",\n options: [\n ...createBaseAppOptions(projectSdk, {\n variant: {\n description: \"Variant of the app to watch\"\n }\n }),\n {\n name: \"json\",\n description: \"Emit output as JSON\",\n type: \"boolean\"\n }\n ],\n handler: async () => {\n ui.info(`Opening %s...`, \"Admin app\");\n\n const appOutput = await projectSdk.getAppStackOutput<{ appUrl: string }>(\"admin\");\n\n if (!appOutput) {\n throw new Error(\n `Could not retrieve URL for \"Admin app\". Please make sure you've deployed the project first.`\n );\n }\n\n const { appUrl } = appOutput;\n if (!appUrl) {\n throw new Error(\n `Could not retrieve URL for \"Admin app\" (\"appUrl\" property missing). Please make sure you've deployed the project first.`\n );\n }\n\n return new Promise<void>(resolve => {\n setTimeout(() => {\n ui.success(`Successfully opened %s.`, \"Admin app\");\n open(appUrl);\n resolve();\n }, 1000);\n });\n }\n };\n }\n}\n\nexport const openCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: OpenCommand,\n dependencies: [GetProjectSdkService, UiService]\n});\n"],"names":["OpenCommand","getProjectSdkService","uiService","projectSdk","ui","createBaseAppOptions","appOutput","Error","appUrl","Promise","resolve","setTimeout","open","openCommand","createImplementation","CliCommandFactory","GetProjectSdkService","UiService"],"mappings":";;;;AAQO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,SAA8B,CACxC;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAA4E;QAC9E,MAAMC,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;QAC1D,MAAMC,KAAK,IAAI,CAAC,SAAS;QAEzB,OAAO;YACH,MAAM;YACN,aAAa;YACb,SAAS;mBACFC,qBAAqBF,YAAY;oBAChC,SAAS;wBACL,aAAa;oBACjB;gBACJ;gBACA;oBACI,MAAM;oBACN,aAAa;oBACb,MAAM;gBACV;aACH;YACD,SAAS;gBACLC,GAAG,IAAI,CAAC,iBAAiB;gBAEzB,MAAME,YAAY,MAAMH,WAAW,iBAAiB,CAAqB;gBAEzE,IAAI,CAACG,WACD,MAAM,IAAIC,MACN;gBAIR,MAAM,EAAEC,MAAM,EAAE,GAAGF;gBACnB,IAAI,CAACE,QACD,MAAM,IAAID,MACN;gBAIR,OAAO,IAAIE,QAAcC,CAAAA;oBACrBC,WAAW;wBACPP,GAAG,OAAO,CAAC,2BAA2B;wBACtCQ,OAAKJ;wBACLE;oBACJ,GAAG;gBACP;YACJ;QACJ;IACJ;AACJ;AAEO,MAAMG,cAAcC,qBAAqB;IAC5C,aAAaC;IACb,gBAAgBf;IAChB,cAAc;QAACgB;QAAsBC;KAAU;AACnD"}
|
|
@@ -1,79 +1,66 @@
|
|
|
1
1
|
import { createImplementation } from "@webiny/di";
|
|
2
2
|
import { CliCommandFactory, GetProjectSdkService, UiService } from "../abstractions/index.js";
|
|
3
3
|
import { createBaseAppOptions } from "./common/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const projectSdk = await this.getProjectSdkService.execute();
|
|
11
|
-
return {
|
|
12
|
-
name: "output",
|
|
13
|
-
description: "Prints Pulumi stack output for given project application and environment",
|
|
14
|
-
params: [{
|
|
15
|
-
name: "app",
|
|
16
|
-
description: "Name of the app (core, admin, or api)",
|
|
17
|
-
type: "string",
|
|
18
|
-
required: true
|
|
19
|
-
}],
|
|
20
|
-
options: [...createBaseAppOptions(projectSdk, {
|
|
21
|
-
variant: {
|
|
22
|
-
description: "Variant of the app to watch"
|
|
23
|
-
}
|
|
24
|
-
}), {
|
|
25
|
-
name: "json",
|
|
26
|
-
description: "Emit output as JSON",
|
|
27
|
-
type: "boolean"
|
|
28
|
-
}],
|
|
29
|
-
handler: async params => {
|
|
4
|
+
class OutputCommand {
|
|
5
|
+
constructor(getProjectSdkService, uiService){
|
|
6
|
+
this.getProjectSdkService = getProjectSdkService;
|
|
7
|
+
this.uiService = uiService;
|
|
8
|
+
}
|
|
9
|
+
async execute() {
|
|
30
10
|
const projectSdk = await this.getProjectSdkService.execute();
|
|
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
|
-
|
|
11
|
+
return {
|
|
12
|
+
name: "output",
|
|
13
|
+
description: "Prints Pulumi stack output for given project application and environment",
|
|
14
|
+
params: [
|
|
15
|
+
{
|
|
16
|
+
name: "app",
|
|
17
|
+
description: "Name of the app (core, admin, or api)",
|
|
18
|
+
type: "string",
|
|
19
|
+
required: true
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
options: [
|
|
23
|
+
...createBaseAppOptions(projectSdk, {
|
|
24
|
+
variant: {
|
|
25
|
+
description: "Variant of the app to watch"
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
{
|
|
29
|
+
name: "json",
|
|
30
|
+
description: "Emit output as JSON",
|
|
31
|
+
type: "boolean"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
handler: async (params)=>{
|
|
35
|
+
const projectSdk = await this.getProjectSdkService.execute();
|
|
36
|
+
const ui = this.uiService;
|
|
37
|
+
const output = await projectSdk.getAppStackOutput(params.app);
|
|
38
|
+
if (params.json) return void ui.text(JSON.stringify(output, null, 2));
|
|
39
|
+
if (!output || 0 === Object.keys(output).length) return void ui.text("No output values found.");
|
|
40
|
+
const formatValue = (key, value, indent = 0)=>{
|
|
41
|
+
const indentStr = " ".repeat(indent);
|
|
42
|
+
if (null == value) return void ui.info(`${indentStr}${key}: (empty)`);
|
|
43
|
+
if ("object" != typeof value || Array.isArray(value)) ui.info(`${indentStr}${key}: ${JSON.stringify(value)}`);
|
|
44
|
+
else {
|
|
45
|
+
if (0 === indent) ui.emptyLine();
|
|
46
|
+
ui.textBold(`${indentStr}${key}:`);
|
|
47
|
+
for (const [k, v] of Object.entries(value))formatValue(k, v, indent + 1);
|
|
48
|
+
if (0 === indent) ui.emptyLine();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
for (const [key, value] of Object.entries(output))formatValue(key, value, 0);
|
|
61
52
|
}
|
|
62
|
-
} else {
|
|
63
|
-
ui.info(`${indentStr}${key}: ${JSON.stringify(value)}`);
|
|
64
|
-
}
|
|
65
53
|
};
|
|
66
|
-
|
|
67
|
-
formatValue(key, value, 0);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
54
|
+
}
|
|
72
55
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
const outputCommand = createImplementation({
|
|
57
|
+
abstraction: CliCommandFactory,
|
|
58
|
+
implementation: OutputCommand,
|
|
59
|
+
dependencies: [
|
|
60
|
+
GetProjectSdkService,
|
|
61
|
+
UiService
|
|
62
|
+
]
|
|
77
63
|
});
|
|
64
|
+
export { OutputCommand, outputCommand };
|
|
78
65
|
|
|
79
66
|
//# sourceMappingURL=OutputCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/OutputCommand.js","sources":["../../src/features/OutputCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { CliCommandFactory, GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\nimport { IBaseAppParams } from \"~/abstractions/features/types.js\";\nimport { createBaseAppOptions } from \"~/features/common/index.js\";\n\nexport interface IOutputCommandParams extends IBaseAppParams {\n json?: boolean;\n}\n\nexport class OutputCommand implements CliCommandFactory.Interface<IOutputCommandParams> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute(): Promise<CliCommandFactory.CommandDefinition<IOutputCommandParams>> {\n const projectSdk = await this.getProjectSdkService.execute();\n\n return {\n name: \"output\",\n description: \"Prints Pulumi stack output for given project application and environment\",\n params: [\n {\n name: \"app\",\n description: \"Name of the app (core, admin, or api)\",\n type: \"string\",\n required: true\n }\n ],\n options: [\n ...createBaseAppOptions(projectSdk, {\n variant: {\n description: \"Variant of the app to watch\"\n }\n }),\n {\n name: \"json\",\n description: \"Emit output as JSON\",\n type: \"boolean\"\n }\n ],\n handler: async (params: IOutputCommandParams) => {\n const projectSdk = await this.getProjectSdkService.execute();\n const ui = this.uiService;\n\n const output = await projectSdk.getAppStackOutput(params.app);\n if (params.json) {\n ui.text(JSON.stringify(output, null, 2));\n return;\n }\n\n // Nice indentation for console output.\n if (!output || Object.keys(output).length === 0) {\n ui.text(\"No output values found.\");\n return;\n }\n\n // Format and display output\n const formatValue = (key: string, value: any, indent: number = 0): void => {\n const indentStr = \" \".repeat(indent);\n\n if (value === null || value === undefined) {\n ui.info(`${indentStr}${key}: (empty)`);\n return;\n }\n\n if (typeof value === \"object\" && !Array.isArray(value)) {\n if (indent === 0) {\n ui.emptyLine();\n }\n ui.textBold(`${indentStr}${key}:`);\n for (const [k, v] of Object.entries(value)) {\n formatValue(k, v, indent + 1);\n }\n if (indent === 0) {\n ui.emptyLine();\n }\n } else {\n ui.info(`${indentStr}${key}: ${JSON.stringify(value)}`);\n }\n };\n\n for (const [key, value] of Object.entries(output)) {\n formatValue(key, value, 0);\n }\n }\n };\n }\n}\n\nexport const outputCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: OutputCommand,\n dependencies: [GetProjectSdkService, UiService]\n});\n"],"names":["OutputCommand","getProjectSdkService","uiService","projectSdk","createBaseAppOptions","params","ui","output","JSON","Object","formatValue","key","value","indent","indentStr","Array","k","v","outputCommand","createImplementation","CliCommandFactory","GetProjectSdkService","UiService"],"mappings":";;;AASO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,SAA8B,CACxC;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAA8E;QAChF,MAAMC,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;QAE1D,OAAO;YACH,MAAM;YACN,aAAa;YACb,QAAQ;gBACJ;oBACI,MAAM;oBACN,aAAa;oBACb,MAAM;oBACN,UAAU;gBACd;aACH;YACD,SAAS;mBACFC,qBAAqBD,YAAY;oBAChC,SAAS;wBACL,aAAa;oBACjB;gBACJ;gBACA;oBACI,MAAM;oBACN,aAAa;oBACb,MAAM;gBACV;aACH;YACD,SAAS,OAAOE;gBACZ,MAAMF,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;gBAC1D,MAAMG,KAAK,IAAI,CAAC,SAAS;gBAEzB,MAAMC,SAAS,MAAMJ,WAAW,iBAAiB,CAACE,OAAO,GAAG;gBAC5D,IAAIA,OAAO,IAAI,EAAE,YACbC,GAAG,IAAI,CAACE,KAAK,SAAS,CAACD,QAAQ,MAAM;gBAKzC,IAAI,CAACA,UAAUE,AAA+B,MAA/BA,OAAO,IAAI,CAACF,QAAQ,MAAM,EAAQ,YAC7CD,GAAG,IAAI,CAAC;gBAKZ,MAAMI,cAAc,CAACC,KAAaC,OAAYC,SAAiB,CAAC;oBAC5D,MAAMC,YAAY,KAAK,MAAM,CAACD;oBAE9B,IAAID,QAAAA,OAAuC,YACvCN,GAAG,IAAI,CAAC,GAAGQ,YAAYH,IAAI,SAAS,CAAC;oBAIzC,IAAI,AAAiB,YAAjB,OAAOC,SAAuBG,MAAM,OAAO,CAACH,QAY5CN,GAAG,IAAI,CAAC,GAAGQ,YAAYH,IAAI,EAAE,EAAEH,KAAK,SAAS,CAACI,QAAQ;yBAZF;wBACpD,IAAIC,AAAW,MAAXA,QACAP,GAAG,SAAS;wBAEhBA,GAAG,QAAQ,CAAC,GAAGQ,YAAYH,IAAI,CAAC,CAAC;wBACjC,KAAK,MAAM,CAACK,GAAGC,EAAE,IAAIR,OAAO,OAAO,CAACG,OAChCF,YAAYM,GAAGC,GAAGJ,SAAS;wBAE/B,IAAIA,AAAW,MAAXA,QACAP,GAAG,SAAS;oBAEpB;gBAGJ;gBAEA,KAAK,MAAM,CAACK,KAAKC,MAAM,IAAIH,OAAO,OAAO,CAACF,QACtCG,YAAYC,KAAKC,OAAO;YAEhC;QACJ;IACJ;AACJ;AAEO,MAAMM,gBAAgBC,qBAAqB;IAC9C,aAAaC;IACb,gBAAgBpB;IAChB,cAAc;QAACqB;QAAsBC;KAAU;AACnD"}
|
|
@@ -2,49 +2,56 @@ import { createImplementation } from "@webiny/di";
|
|
|
2
2
|
import { CliCommandFactory, GetProjectSdkService, StdioService, UiService } from "../../abstractions/index.js";
|
|
3
3
|
import { ManuallyReportedError } from "../../utils/ManuallyReportedError.js";
|
|
4
4
|
import { createBaseAppOptions } from "../common/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const projectSdk = await this.getProjectSdkService.execute();
|
|
13
|
-
return {
|
|
14
|
-
name: "pulumi",
|
|
15
|
-
description: 'Runs a Pulumi command in the provided project application folder. Note: make sure to use "--" before the actual Pulumi command',
|
|
16
|
-
examples: ["$0 pulumi api --env dev -- config set foo bar --secret"],
|
|
17
|
-
params: [{
|
|
18
|
-
name: "app",
|
|
19
|
-
description: "Name of the app (core, admin, or api)",
|
|
20
|
-
type: "string",
|
|
21
|
-
required: true
|
|
22
|
-
}],
|
|
23
|
-
options: createBaseAppOptions(projectSdk),
|
|
24
|
-
handler: async params => {
|
|
5
|
+
class PulumiCommand {
|
|
6
|
+
constructor(getProjectSdkService, uiService, stdioService){
|
|
7
|
+
this.getProjectSdkService = getProjectSdkService;
|
|
8
|
+
this.uiService = uiService;
|
|
9
|
+
this.stdioService = stdioService;
|
|
10
|
+
}
|
|
11
|
+
async execute() {
|
|
25
12
|
const projectSdk = await this.getProjectSdkService.execute();
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
return {
|
|
14
|
+
name: "pulumi",
|
|
15
|
+
description: 'Runs a Pulumi command in the provided project application folder. Note: make sure to use "--" before the actual Pulumi command',
|
|
16
|
+
examples: [
|
|
17
|
+
"$0 pulumi api --env dev -- config set foo bar --secret"
|
|
18
|
+
],
|
|
19
|
+
params: [
|
|
20
|
+
{
|
|
21
|
+
name: "app",
|
|
22
|
+
description: "Name of the app (core, admin, or api)",
|
|
23
|
+
type: "string",
|
|
24
|
+
required: true
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
options: createBaseAppOptions(projectSdk),
|
|
28
|
+
handler: async (params)=>{
|
|
29
|
+
const projectSdk = await this.getProjectSdkService.execute();
|
|
30
|
+
try {
|
|
31
|
+
const [, ...command] = params._ || [];
|
|
32
|
+
const { pulumiProcess } = await projectSdk.runPulumiCommand({
|
|
33
|
+
...params,
|
|
34
|
+
command
|
|
35
|
+
});
|
|
36
|
+
pulumiProcess.stdin?.pipe(this.stdioService.getStdin());
|
|
37
|
+
pulumiProcess.stdout?.pipe(this.stdioService.getStdout());
|
|
38
|
+
pulumiProcess.stderr?.pipe(this.stdioService.getStderr());
|
|
39
|
+
} catch (error) {
|
|
40
|
+
throw ManuallyReportedError.from(error);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
43
45
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const pulumiCommand = createImplementation({
|
|
47
|
+
abstraction: CliCommandFactory,
|
|
48
|
+
implementation: PulumiCommand,
|
|
49
|
+
dependencies: [
|
|
50
|
+
GetProjectSdkService,
|
|
51
|
+
UiService,
|
|
52
|
+
StdioService
|
|
53
|
+
]
|
|
48
54
|
});
|
|
55
|
+
export { PulumiCommand, pulumiCommand };
|
|
49
56
|
|
|
50
57
|
//# sourceMappingURL=PulumiCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/PulumiCommand/PulumiCommand.js","sources":["../../../src/features/PulumiCommand/PulumiCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport {\n CliCommandFactory,\n GetProjectSdkService,\n StdioService,\n UiService\n} from \"~/abstractions/index.js\";\nimport { ManuallyReportedError } from \"~/utils/ManuallyReportedError.js\";\nimport { IBaseAppParams } from \"~/abstractions/features/types.js\";\nimport { createBaseAppOptions } from \"~/features/common/index.js\";\n\nexport interface IPulumiCommandParams extends IBaseAppParams {\n command: string[];\n}\n\nexport class PulumiCommand implements CliCommandFactory.Interface<IPulumiCommandParams> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface,\n private stdioService: StdioService.Interface\n ) {}\n\n async execute(): Promise<CliCommandFactory.CommandDefinition<IPulumiCommandParams>> {\n const projectSdk = await this.getProjectSdkService.execute();\n\n return {\n name: \"pulumi\",\n description:\n 'Runs a Pulumi command in the provided project application folder. Note: make sure to use \"--\" before the actual Pulumi command',\n examples: [\"$0 pulumi api --env dev -- config set foo bar --secret\"],\n params: [\n {\n name: \"app\",\n description: \"Name of the app (core, admin, or api)\",\n type: \"string\",\n required: true\n }\n ],\n options: createBaseAppOptions(projectSdk),\n handler: async (params: IPulumiCommandParams) => {\n const projectSdk = await this.getProjectSdkService.execute();\n\n try {\n const [, ...command] = params._ || [];\n\n const { pulumiProcess } = await projectSdk.runPulumiCommand({\n ...params,\n command\n });\n\n pulumiProcess.stdin?.pipe(this.stdioService.getStdin());\n pulumiProcess.stdout?.pipe(this.stdioService.getStdout());\n pulumiProcess.stderr?.pipe(this.stdioService.getStderr());\n } catch (error) {\n throw ManuallyReportedError.from(error);\n }\n }\n };\n }\n}\n\nexport const pulumiCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: PulumiCommand,\n dependencies: [GetProjectSdkService, UiService, StdioService]\n});\n"],"names":["PulumiCommand","getProjectSdkService","uiService","stdioService","projectSdk","createBaseAppOptions","params","command","pulumiProcess","error","ManuallyReportedError","pulumiCommand","createImplementation","CliCommandFactory","GetProjectSdkService","UiService","StdioService"],"mappings":";;;;AAeO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,SAA8B,EAC9BC,YAAoC,CAC9C;aAHUF,oBAAoB,GAApBA;aACAC,SAAS,GAATA;aACAC,YAAY,GAAZA;IACT;IAEH,MAAM,UAA8E;QAChF,MAAMC,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;QAE1D,OAAO;YACH,MAAM;YACN,aACI;YACJ,UAAU;gBAAC;aAAyD;YACpE,QAAQ;gBACJ;oBACI,MAAM;oBACN,aAAa;oBACb,MAAM;oBACN,UAAU;gBACd;aACH;YACD,SAASC,qBAAqBD;YAC9B,SAAS,OAAOE;gBACZ,MAAMF,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;gBAE1D,IAAI;oBACA,MAAM,GAAG,GAAGG,QAAQ,GAAGD,OAAO,CAAC,IAAI,EAAE;oBAErC,MAAM,EAAEE,aAAa,EAAE,GAAG,MAAMJ,WAAW,gBAAgB,CAAC;wBACxD,GAAGE,MAAM;wBACTC;oBACJ;oBAEAC,cAAc,KAAK,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,QAAQ;oBACpDA,cAAc,MAAM,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,SAAS;oBACtDA,cAAc,MAAM,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,SAAS;gBAC1D,EAAE,OAAOC,OAAO;oBACZ,MAAMC,sBAAsB,IAAI,CAACD;gBACrC;YACJ;QACJ;IACJ;AACJ;AAEO,MAAME,gBAAgBC,qBAAqB;IAC9C,aAAaC;IACb,gBAAgBb;IAChB,cAAc;QAACc;QAAsBC;QAAWC;KAAa;AACjE"}
|
|
@@ -2,44 +2,50 @@ import { createImplementation } from "@webiny/di";
|
|
|
2
2
|
import { CliCommandFactory, GetProjectSdkService, StdioService } from "../../abstractions/index.js";
|
|
3
3
|
import { ManuallyReportedError } from "../../utils/ManuallyReportedError.js";
|
|
4
4
|
import { createBaseAppOptions } from "../common/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const projectSdk = await this.getProjectSdkService.execute();
|
|
12
|
-
return {
|
|
13
|
-
name: "refresh",
|
|
14
|
-
description: "Refreshes Pulumi state for given project application and environment",
|
|
15
|
-
examples: ["$0 refresh api --env dev -- config set foo bar --secret"],
|
|
16
|
-
params: [{
|
|
17
|
-
name: "app",
|
|
18
|
-
description: "Name of the app (core, admin, or api)",
|
|
19
|
-
type: "string",
|
|
20
|
-
required: true
|
|
21
|
-
}],
|
|
22
|
-
options: createBaseAppOptions(projectSdk),
|
|
23
|
-
handler: async params => {
|
|
5
|
+
class RefreshCommand {
|
|
6
|
+
constructor(getProjectSdkService, stdioService){
|
|
7
|
+
this.getProjectSdkService = getProjectSdkService;
|
|
8
|
+
this.stdioService = stdioService;
|
|
9
|
+
}
|
|
10
|
+
async execute() {
|
|
24
11
|
const projectSdk = await this.getProjectSdkService.execute();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
12
|
+
return {
|
|
13
|
+
name: "refresh",
|
|
14
|
+
description: "Refreshes Pulumi state for given project application and environment",
|
|
15
|
+
examples: [
|
|
16
|
+
"$0 refresh api --env dev -- config set foo bar --secret"
|
|
17
|
+
],
|
|
18
|
+
params: [
|
|
19
|
+
{
|
|
20
|
+
name: "app",
|
|
21
|
+
description: "Name of the app (core, admin, or api)",
|
|
22
|
+
type: "string",
|
|
23
|
+
required: true
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
options: createBaseAppOptions(projectSdk),
|
|
27
|
+
handler: async (params)=>{
|
|
28
|
+
const projectSdk = await this.getProjectSdkService.execute();
|
|
29
|
+
try {
|
|
30
|
+
const { pulumiProcess } = await projectSdk.refreshApp(params);
|
|
31
|
+
pulumiProcess.stdin?.pipe(this.stdioService.getStdin());
|
|
32
|
+
pulumiProcess.stdout?.pipe(this.stdioService.getStdout());
|
|
33
|
+
pulumiProcess.stderr?.pipe(this.stdioService.getStderr());
|
|
34
|
+
} catch (error) {
|
|
35
|
+
throw ManuallyReportedError.from(error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const refreshCommand = createImplementation({
|
|
42
|
+
abstraction: CliCommandFactory,
|
|
43
|
+
implementation: RefreshCommand,
|
|
44
|
+
dependencies: [
|
|
45
|
+
GetProjectSdkService,
|
|
46
|
+
StdioService
|
|
47
|
+
]
|
|
43
48
|
});
|
|
49
|
+
export { RefreshCommand, refreshCommand };
|
|
44
50
|
|
|
45
51
|
//# sourceMappingURL=RefreshCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/RefreshCommand/RefreshCommand.js","sources":["../../../src/features/RefreshCommand/RefreshCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { CliCommandFactory, GetProjectSdkService, StdioService } from \"~/abstractions/index.js\";\nimport { ManuallyReportedError } from \"~/utils/ManuallyReportedError.js\";\nimport { IBaseAppParams } from \"~/abstractions/features/types.js\";\nimport { createBaseAppOptions } from \"~/features/common/index.js\";\n\nexport interface IRefreshCommandParams extends IBaseAppParams {\n command: string[];\n}\n\nexport class RefreshCommand implements CliCommandFactory.Interface<IRefreshCommandParams> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private stdioService: StdioService.Interface\n ) {}\n\n async execute(): Promise<CliCommandFactory.CommandDefinition<IRefreshCommandParams>> {\n const projectSdk = await this.getProjectSdkService.execute();\n\n return {\n name: \"refresh\",\n description: \"Refreshes Pulumi state for given project application and environment\",\n examples: [\"$0 refresh api --env dev -- config set foo bar --secret\"],\n params: [\n {\n name: \"app\",\n description: \"Name of the app (core, admin, or api)\",\n type: \"string\",\n required: true\n }\n ],\n options: createBaseAppOptions(projectSdk),\n handler: async (params: IRefreshCommandParams) => {\n const projectSdk = await this.getProjectSdkService.execute();\n\n try {\n const { pulumiProcess } = await projectSdk.refreshApp(params);\n pulumiProcess.stdin?.pipe(this.stdioService.getStdin());\n pulumiProcess.stdout?.pipe(this.stdioService.getStdout());\n pulumiProcess.stderr?.pipe(this.stdioService.getStderr());\n } catch (error) {\n throw ManuallyReportedError.from(error);\n }\n }\n };\n }\n}\n\nexport const refreshCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: RefreshCommand,\n dependencies: [GetProjectSdkService, StdioService]\n});\n"],"names":["RefreshCommand","getProjectSdkService","stdioService","projectSdk","createBaseAppOptions","params","pulumiProcess","error","ManuallyReportedError","refreshCommand","createImplementation","CliCommandFactory","GetProjectSdkService","StdioService"],"mappings":";;;;AAUO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,YAAoC,CAC9C;aAFUD,oBAAoB,GAApBA;aACAC,YAAY,GAAZA;IACT;IAEH,MAAM,UAA+E;QACjF,MAAMC,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;QAE1D,OAAO;YACH,MAAM;YACN,aAAa;YACb,UAAU;gBAAC;aAA0D;YACrE,QAAQ;gBACJ;oBACI,MAAM;oBACN,aAAa;oBACb,MAAM;oBACN,UAAU;gBACd;aACH;YACD,SAASC,qBAAqBD;YAC9B,SAAS,OAAOE;gBACZ,MAAMF,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;gBAE1D,IAAI;oBACA,MAAM,EAAEG,aAAa,EAAE,GAAG,MAAMH,WAAW,UAAU,CAACE;oBACtDC,cAAc,KAAK,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,QAAQ;oBACpDA,cAAc,MAAM,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,SAAS;oBACtDA,cAAc,MAAM,EAAE,KAAK,IAAI,CAAC,YAAY,CAAC,SAAS;gBAC1D,EAAE,OAAOC,OAAO;oBACZ,MAAMC,sBAAsB,IAAI,CAACD;gBACrC;YACJ;QACJ;IACJ;AACJ;AAEO,MAAME,iBAAiBC,qBAAqB;IAC/C,aAAaC;IACb,gBAAgBX;IAChB,cAAc;QAACY;QAAsBC;KAAa;AACtD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CliCommandFactory, UiService } from "../../abstractions/index.js";
|
|
2
|
+
import { UpgradeCommandHandler } from "./abstraction.js";
|
|
3
|
+
interface UpgradeCommandParams {
|
|
4
|
+
skipChecks?: boolean;
|
|
5
|
+
disableSemver?: boolean;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
_: string[];
|
|
8
|
+
force?: boolean;
|
|
9
|
+
target?: string;
|
|
10
|
+
logLevel?: string;
|
|
11
|
+
showLogs?: boolean;
|
|
12
|
+
showStackTrace?: boolean;
|
|
13
|
+
version?: string;
|
|
14
|
+
registry?: string;
|
|
15
|
+
packageManager?: string;
|
|
16
|
+
installVersion?: string;
|
|
17
|
+
skipDependencyGuard?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare class UpgradeCommandImpl implements CliCommandFactory.Interface<UpgradeCommandParams> {
|
|
20
|
+
private ui;
|
|
21
|
+
private upgradeCommandHandler;
|
|
22
|
+
constructor(ui: UiService.Interface, upgradeCommandHandler: UpgradeCommandHandler.Interface);
|
|
23
|
+
execute(): Promise<CliCommandFactory.CommandDefinition<UpgradeCommandParams>>;
|
|
24
|
+
private getVersion;
|
|
25
|
+
}
|
|
26
|
+
export declare const UpgradeCommand: typeof UpgradeCommandImpl & {
|
|
27
|
+
__abstraction: import("@webiny/di").Abstraction<import("../../abstractions/features/CliCommand.js").ICliCommand<any>>;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { CliCommandFactory, UiService } from "../../abstractions/index.js";
|
|
2
|
+
import { UpgradeCommandHandler } from "./abstraction.js";
|
|
3
|
+
import semver from "semver";
|
|
4
|
+
class UpgradeCommandImpl {
|
|
5
|
+
constructor(ui, upgradeCommandHandler){
|
|
6
|
+
this.ui = ui;
|
|
7
|
+
this.upgradeCommandHandler = upgradeCommandHandler;
|
|
8
|
+
}
|
|
9
|
+
async execute() {
|
|
10
|
+
return {
|
|
11
|
+
name: "upgrade",
|
|
12
|
+
description: "Upgrade Webiny packages and dependencies to the latest or selected version.",
|
|
13
|
+
examples: [
|
|
14
|
+
"upgrade",
|
|
15
|
+
"upgrade 6.2.0",
|
|
16
|
+
"upgrade 0.0.0-unstable.abc --disable-semver"
|
|
17
|
+
],
|
|
18
|
+
params: [
|
|
19
|
+
{
|
|
20
|
+
name: "target",
|
|
21
|
+
description: "Target version to upgrade to. Can be a specific version (e.g. 6.2.0) or 'latest' to upgrade to the latest version.",
|
|
22
|
+
type: "string",
|
|
23
|
+
default: "latest",
|
|
24
|
+
required: false
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
options: [
|
|
28
|
+
{
|
|
29
|
+
name: "force",
|
|
30
|
+
description: "Force an upgrade for a version, even if it was ran before.",
|
|
31
|
+
type: "boolean",
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "skip-checks",
|
|
36
|
+
description: "Do not perform CLI version and Git tree checks.",
|
|
37
|
+
type: "boolean",
|
|
38
|
+
default: false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "log-level",
|
|
42
|
+
default: "debug",
|
|
43
|
+
description: 'Set log level for the upgrade process executed by npx. Possible values are "debug", "info", "warning", and "error".',
|
|
44
|
+
type: "string"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "show-logs",
|
|
48
|
+
default: false,
|
|
49
|
+
description: "Show logs from the upgrade process executed by npx.",
|
|
50
|
+
type: "boolean"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "show-stack-trace",
|
|
54
|
+
default: false,
|
|
55
|
+
description: "Show stack trace if the upgrade process executed by npx fails.",
|
|
56
|
+
type: "boolean"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "registry",
|
|
60
|
+
type: "string",
|
|
61
|
+
default: "",
|
|
62
|
+
description: "registry URL"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "package-manager",
|
|
66
|
+
type: "string",
|
|
67
|
+
default: "",
|
|
68
|
+
description: "Package manager to use: yarn, pnpm, or npm (auto-detected from lock file if omitted)"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "skip-dependency-guard",
|
|
72
|
+
default: false,
|
|
73
|
+
description: "Skip the dependency guard that checks for incompatible dependencies before performing the upgrade.",
|
|
74
|
+
type: "boolean"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "install-version",
|
|
78
|
+
type: "string",
|
|
79
|
+
default: "",
|
|
80
|
+
description: "Install a specific version of Webiny, no matter the version upgrade script is running for. Eg. upgrade script is for 6.5.0 but you want to install 6.5.0-rc.0"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
handler: async (params)=>{
|
|
84
|
+
const version = this.getVersion(params);
|
|
85
|
+
return this.upgradeCommandHandler.handle({
|
|
86
|
+
force: params.force || false,
|
|
87
|
+
logLevel: params.logLevel || "info",
|
|
88
|
+
showLogs: params.showLogs || false,
|
|
89
|
+
showStackTrace: params.showStackTrace || false,
|
|
90
|
+
skipChecks: params.skipChecks || false,
|
|
91
|
+
debug: true,
|
|
92
|
+
packageManager: params.packageManager || void 0,
|
|
93
|
+
registry: params.registry || void 0,
|
|
94
|
+
installVersion: params.installVersion || void 0,
|
|
95
|
+
skipDependencyGuard: params.skipDependencyGuard || false,
|
|
96
|
+
version
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
getVersion(params) {
|
|
102
|
+
const version = semver.valid(params._[1]) ? params._[1] : params.target;
|
|
103
|
+
if (!version || "latest" === version) return "latest";
|
|
104
|
+
if (params.disableSemver) return version;
|
|
105
|
+
try {
|
|
106
|
+
const parsed = semver.parse(version);
|
|
107
|
+
if (!parsed) throw new Error();
|
|
108
|
+
return parsed.format();
|
|
109
|
+
} catch (ex) {
|
|
110
|
+
throw new Error(`Invalid version provided: "${version}". Use --disable-semver to allow non-semver versions: ${ex.message}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const UpgradeCommand = CliCommandFactory.createImplementation({
|
|
115
|
+
implementation: UpgradeCommandImpl,
|
|
116
|
+
dependencies: [
|
|
117
|
+
UiService,
|
|
118
|
+
UpgradeCommandHandler
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
export { UpgradeCommand };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=UpgradeCommand.js.map
|