@webiny/cli-core 0.0.0-unstable.0d717d18dd → 0.0.0-unstable.292eb6dc15
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/createCliContainer.js +18 -15
- package/createCliContainer.js.map +1 -1
- package/exports/extensions.d.ts +1 -0
- package/exports/extensions.js +1 -0
- package/extensions/CliCommand.js +2 -1
- package/extensions/CliCommand.js.map +1 -1
- package/extensions/CliCommandDecorator.js +2 -1
- package/extensions/CliCommandDecorator.js.map +1 -1
- package/features/AboutCommand.js +6 -11
- package/features/AboutCommand.js.map +1 -1
- package/features/DepsSync/DependencyTree.js +1 -1
- package/features/DepsSync/DependencyTree.js.map +1 -1
- package/features/DepsSync/ListAllPackages.d.ts +1 -1
- package/features/DepsSync/ListAllPackages.js +2 -2
- package/features/DepsSync/ListAllPackages.js.map +1 -1
- package/features/DepsSync/commands/SyncDepsCommand.js +1 -1
- package/features/DepsSync/commands/SyncDepsCommand.js.map +1 -1
- package/features/DepsSync/commands/VerifyDepsCommand.js +40 -3
- package/features/DepsSync/commands/VerifyDepsCommand.js.map +1 -1
- package/features/DepsSync/createDependencyTree.d.ts +1 -1
- package/features/DepsSync/createDependencyTree.js +8 -5
- package/features/DepsSync/createDependencyTree.js.map +1 -1
- package/features/DepsSync/paths.js +1 -1
- package/features/DepsSync/paths.js.map +1 -1
- package/features/DepsSync/types.js.map +1 -1
- package/features/Wcp/LinkProjectCommand.js +1 -1
- package/features/Wcp/LinkProjectCommand.js.map +1 -1
- package/features/globalOptions/TraceGlobalOption.d.ts +5 -0
- package/features/globalOptions/TraceGlobalOption.js +22 -0
- package/features/globalOptions/TraceGlobalOption.js.map +1 -0
- package/features/globalOptions/index.d.ts +1 -0
- package/features/globalOptions/index.js +1 -0
- package/features/index.d.ts +0 -2
- package/features/index.js +0 -2
- package/namespaces/cli.d.ts +5 -0
- package/namespaces/cli.js +7 -0
- package/namespaces/cli.js.map +1 -0
- package/package.json +26 -23
- package/services/GetCliRunnerService/GetCliRunnerService.js +6 -2
- package/services/GetCliRunnerService/GetCliRunnerService.js.map +1 -1
- package/services/UiService/UiService.d.ts +18 -0
- package/services/UiService/UiService.js +18 -2
- package/services/UiService/UiService.js.map +1 -1
- package/utils/{ensureSameWebinyPackageVersions.js → ensureSameWebinyPackageVersions/ensureSameWebinyPackageVersions.js} +12 -22
- package/utils/ensureSameWebinyPackageVersions/ensureSameWebinyPackageVersions.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/getCacheFilePath.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/getCacheFilePath.js +12 -0
- package/utils/ensureSameWebinyPackageVersions/getCacheFilePath.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/hashYarnLock.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/hashYarnLock.js +16 -0
- package/utils/ensureSameWebinyPackageVersions/hashYarnLock.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/index.d.ts +6 -0
- package/utils/ensureSameWebinyPackageVersions/index.js +6 -0
- package/utils/ensureSameWebinyPackageVersions/listWebinyPackageVersions.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/listWebinyPackageVersions.js +31 -0
- package/utils/ensureSameWebinyPackageVersions/listWebinyPackageVersions.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/readClearedYarnLockHash.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/readClearedYarnLockHash.js +13 -0
- package/utils/ensureSameWebinyPackageVersions/readClearedYarnLockHash.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.js +24 -0
- package/utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.js.map +1 -0
- package/features/InfoCommand/InfoCommand.d.ts +0 -10
- package/features/InfoCommand/InfoCommand.js +0 -62
- package/features/InfoCommand/InfoCommand.js.map +0 -1
- package/features/InfoCommand/PrintInfoForEnv.d.ts +0 -14
- package/features/InfoCommand/PrintInfoForEnv.js +0 -37
- package/features/InfoCommand/PrintInfoForEnv.js.map +0 -1
- package/features/InfoCommand/index.d.ts +0 -1
- package/features/InfoCommand/index.js +0 -1
- package/features/OpenCommand.d.ts +0 -10
- package/features/OpenCommand.js +0 -55
- package/features/OpenCommand.js.map +0 -1
- package/utils/ensureSameWebinyPackageVersions.js.map +0 -1
- /package/utils/{ensureSameWebinyPackageVersions.d.ts → ensureSameWebinyPackageVersions/ensureSameWebinyPackageVersions.d.ts} +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import crypto_0 from "crypto";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
const writeClearedYarnLockHash = (cacheFilePath, yarnLockHash)=>{
|
|
5
|
+
const temporaryFilePath = `${cacheFilePath}.${process.pid}.${crypto_0.randomUUID()}.tmp`;
|
|
6
|
+
try {
|
|
7
|
+
fs.mkdirSync(path.dirname(cacheFilePath), {
|
|
8
|
+
recursive: true
|
|
9
|
+
});
|
|
10
|
+
fs.writeFileSync(temporaryFilePath, JSON.stringify({
|
|
11
|
+
yarnLockHash
|
|
12
|
+
}));
|
|
13
|
+
fs.renameSync(temporaryFilePath, cacheFilePath);
|
|
14
|
+
} catch {
|
|
15
|
+
try {
|
|
16
|
+
fs.rmSync(temporaryFilePath, {
|
|
17
|
+
force: true
|
|
18
|
+
});
|
|
19
|
+
} catch {}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export { writeClearedYarnLockHash };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=writeClearedYarnLockHash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.js","sources":["../../../src/utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.ts"],"sourcesContent":["import crypto from \"crypto\";\nimport fs from \"fs\";\nimport path from \"path\";\n\n/*\n * Records the lockfile hash that the version check just passed on.\n *\n * Written to a temporary file and renamed into place, because `webiny watch` can be running while\n * another command starts. A plain write truncates first, so a reader arriving in that window would\n * parse a half-written file, treat it as a miss and pay for `yarn info` again. The rename is atomic,\n * and the temporary file sits in the same directory so it never crosses a filesystem boundary.\n */\nexport const writeClearedYarnLockHash = (cacheFilePath: string, yarnLockHash: string): void => {\n const temporaryFilePath = `${cacheFilePath}.${process.pid}.${crypto.randomUUID()}.tmp`;\n\n try {\n fs.mkdirSync(path.dirname(cacheFilePath), { recursive: true });\n fs.writeFileSync(temporaryFilePath, JSON.stringify({ yarnLockHash }));\n fs.renameSync(temporaryFilePath, cacheFilePath);\n } catch {\n // A read-only or otherwise unwritable project just pays for the check every time. Clear the\n // temporary file if we got as far as creating one, so failures don't pile up in `.webiny/`.\n try {\n fs.rmSync(temporaryFilePath, { force: true });\n } catch {\n // Nothing further to try.\n }\n }\n};\n"],"names":["writeClearedYarnLockHash","cacheFilePath","yarnLockHash","temporaryFilePath","process","crypto","fs","path","JSON"],"mappings":";;;AAYO,MAAMA,2BAA2B,CAACC,eAAuBC;IAC5D,MAAMC,oBAAoB,GAAGF,cAAc,CAAC,EAAEG,QAAQ,GAAG,CAAC,CAAC,EAAEC,SAAAA,UAAiB,GAAG,IAAI,CAAC;IAEtF,IAAI;QACAC,GAAG,SAAS,CAACC,KAAK,OAAO,CAACN,gBAAgB;YAAE,WAAW;QAAK;QAC5DK,GAAG,aAAa,CAACH,mBAAmBK,KAAK,SAAS,CAAC;YAAEN;QAAa;QAClEI,GAAG,UAAU,CAACH,mBAAmBF;IACrC,EAAE,OAAM;QAGJ,IAAI;YACAK,GAAG,MAAM,CAACH,mBAAmB;gBAAE,OAAO;YAAK;QAC/C,EAAE,OAAM,CAER;IACJ;AACJ"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CliCommandFactory, GetProjectSdkService, UiService } from "../../abstractions/index.js";
|
|
2
|
-
import { IBaseAppParams } from "../../abstractions/features/types.js";
|
|
3
|
-
export type IInfoCommandParams = Omit<IBaseAppParams, "app">;
|
|
4
|
-
export declare class InfoCommand implements CliCommandFactory.Interface<IInfoCommandParams> {
|
|
5
|
-
private getProjectSdkService;
|
|
6
|
-
private uiService;
|
|
7
|
-
constructor(getProjectSdkService: GetProjectSdkService.Interface, uiService: UiService.Interface);
|
|
8
|
-
execute(): Promise<CliCommandFactory.CommandDefinition<IInfoCommandParams>>;
|
|
9
|
-
}
|
|
10
|
-
export declare const infoCommand: import("@webiny/di").Implementation<typeof InfoCommand>;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/di";
|
|
2
|
-
import { CliCommandFactory, GetProjectSdkService, UiService } from "../../abstractions/index.js";
|
|
3
|
-
import { PrintInfoForEnv } from "./PrintInfoForEnv.js";
|
|
4
|
-
import { createBaseAppOptions } from "../common/index.js";
|
|
5
|
-
class InfoCommand {
|
|
6
|
-
constructor(getProjectSdkService, uiService){
|
|
7
|
-
this.getProjectSdkService = getProjectSdkService;
|
|
8
|
-
this.uiService = uiService;
|
|
9
|
-
}
|
|
10
|
-
async execute() {
|
|
11
|
-
const projectSdk = await this.getProjectSdkService.execute();
|
|
12
|
-
return {
|
|
13
|
-
name: "info",
|
|
14
|
-
description: "Lists relevant URLs for your Webiny project",
|
|
15
|
-
options: createBaseAppOptions(projectSdk),
|
|
16
|
-
handler: async (params)=>{
|
|
17
|
-
const ui = this.uiService;
|
|
18
|
-
const printInfoForEnv = new PrintInfoForEnv({
|
|
19
|
-
getProjectSdkService: this.getProjectSdkService,
|
|
20
|
-
uiService: this.uiService
|
|
21
|
-
});
|
|
22
|
-
if (params.env) {
|
|
23
|
-
await printInfoForEnv.execute({
|
|
24
|
-
env: params.env,
|
|
25
|
-
variant: params.variant
|
|
26
|
-
});
|
|
27
|
-
ui.emptyLine();
|
|
28
|
-
} else {
|
|
29
|
-
const existingEnvs = await projectSdk.listDeployedEnvironments();
|
|
30
|
-
if (0 === existingEnvs.length) return void ui.info("It seems that no environments have been deployed yet. Please deploy the project first.");
|
|
31
|
-
if (1 === existingEnvs.length) {
|
|
32
|
-
ui.info("There is one deployed environment.");
|
|
33
|
-
ui.info("Here is the information for the environment.");
|
|
34
|
-
} else {
|
|
35
|
-
ui.info("There's a total of %d deployed environments.", existingEnvs.length);
|
|
36
|
-
ui.info("Here is the information for each environment.");
|
|
37
|
-
console.log();
|
|
38
|
-
}
|
|
39
|
-
for (const { env, variant } of existingEnvs){
|
|
40
|
-
await printInfoForEnv.execute({
|
|
41
|
-
env,
|
|
42
|
-
variant
|
|
43
|
-
});
|
|
44
|
-
ui.emptyLine();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
ui.info("If some of the information is missing for a particular environment, make sure that the project has been fully deployed into that environment. You can do that by running the %s command.", "yarn webiny deploy --env {ENVIRONMENT_NAME}");
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const infoCommand = createImplementation({
|
|
53
|
-
abstraction: CliCommandFactory,
|
|
54
|
-
implementation: InfoCommand,
|
|
55
|
-
dependencies: [
|
|
56
|
-
GetProjectSdkService,
|
|
57
|
-
UiService
|
|
58
|
-
]
|
|
59
|
-
});
|
|
60
|
-
export { InfoCommand, infoCommand };
|
|
61
|
-
|
|
62
|
-
//# sourceMappingURL=InfoCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/InfoCommand/InfoCommand.js","sources":["../../../src/features/InfoCommand/InfoCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { CliCommandFactory, GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\nimport { IBaseAppParams } from \"~/abstractions/features/types.js\";\nimport { PrintInfoForEnv } from \"./PrintInfoForEnv.js\";\nimport { createBaseAppOptions } from \"~/features/common/index.js\";\n\nexport type IInfoCommandParams = Omit<IBaseAppParams, \"app\">;\n\nexport class InfoCommand implements CliCommandFactory.Interface<IInfoCommandParams> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute(): Promise<CliCommandFactory.CommandDefinition<IInfoCommandParams>> {\n const projectSdk = await this.getProjectSdkService.execute();\n\n return {\n name: \"info\",\n description: \"Lists relevant URLs for your Webiny project\",\n options: createBaseAppOptions(projectSdk),\n handler: async params => {\n const ui = this.uiService;\n\n const printInfoForEnv = new PrintInfoForEnv({\n getProjectSdkService: this.getProjectSdkService,\n uiService: this.uiService\n });\n\n if (params.env) {\n await printInfoForEnv.execute({ env: params.env, variant: params.variant });\n ui.emptyLine();\n } else {\n const existingEnvs = await projectSdk.listDeployedEnvironments();\n\n if (existingEnvs.length === 0) {\n ui.info(\n \"It seems that no environments have been deployed yet. Please deploy the project first.\"\n );\n return;\n }\n\n if (existingEnvs.length === 1) {\n ui.info(\"There is one deployed environment.\");\n ui.info(\"Here is the information for the environment.\");\n } else {\n ui.info(\n \"There's a total of %d deployed environments.\",\n existingEnvs.length\n );\n ui.info(\"Here is the information for each environment.\");\n console.log();\n }\n\n for (const { env, variant } of existingEnvs) {\n await printInfoForEnv.execute({ env, variant });\n ui.emptyLine();\n }\n }\n\n ui.info(\n \"If some of the information is missing for a particular environment, make sure that the project has been fully deployed into that environment. You can do that by running the %s command.\",\n \"yarn webiny deploy --env {ENVIRONMENT_NAME}\"\n );\n }\n };\n }\n}\n\nexport const infoCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: InfoCommand,\n dependencies: [GetProjectSdkService, UiService]\n});\n"],"names":["InfoCommand","getProjectSdkService","uiService","projectSdk","createBaseAppOptions","params","ui","printInfoForEnv","PrintInfoForEnv","existingEnvs","console","env","variant","infoCommand","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;QAE1D,OAAO;YACH,MAAM;YACN,aAAa;YACb,SAASC,qBAAqBD;YAC9B,SAAS,OAAME;gBACX,MAAMC,KAAK,IAAI,CAAC,SAAS;gBAEzB,MAAMC,kBAAkB,IAAIC,gBAAgB;oBACxC,sBAAsB,IAAI,CAAC,oBAAoB;oBAC/C,WAAW,IAAI,CAAC,SAAS;gBAC7B;gBAEA,IAAIH,OAAO,GAAG,EAAE;oBACZ,MAAME,gBAAgB,OAAO,CAAC;wBAAE,KAAKF,OAAO,GAAG;wBAAE,SAASA,OAAO,OAAO;oBAAC;oBACzEC,GAAG,SAAS;gBAChB,OAAO;oBACH,MAAMG,eAAe,MAAMN,WAAW,wBAAwB;oBAE9D,IAAIM,AAAwB,MAAxBA,aAAa,MAAM,EAAQ,YAC3BH,GAAG,IAAI,CACH;oBAKR,IAAIG,AAAwB,MAAxBA,aAAa,MAAM,EAAQ;wBAC3BH,GAAG,IAAI,CAAC;wBACRA,GAAG,IAAI,CAAC;oBACZ,OAAO;wBACHA,GAAG,IAAI,CACH,gDACAG,aAAa,MAAM;wBAEvBH,GAAG,IAAI,CAAC;wBACRI,QAAQ,GAAG;oBACf;oBAEA,KAAK,MAAM,EAAEC,GAAG,EAAEC,OAAO,EAAE,IAAIH,aAAc;wBACzC,MAAMF,gBAAgB,OAAO,CAAC;4BAAEI;4BAAKC;wBAAQ;wBAC7CN,GAAG,SAAS;oBAChB;gBACJ;gBAEAA,GAAG,IAAI,CACH,4LACA;YAER;QACJ;IACJ;AACJ;AAEO,MAAMO,cAAcC,qBAAqB;IAC5C,aAAaC;IACb,gBAAgBf;IAChB,cAAc;QAACgB;QAAsBC;KAAU;AACnD"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { GetProjectSdkService, UiService } from "../../abstractions/index.js";
|
|
2
|
-
export interface IPrintInfoForEnvParams {
|
|
3
|
-
env: string;
|
|
4
|
-
variant?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface IPrintInfoForEnvDi {
|
|
7
|
-
getProjectSdkService: GetProjectSdkService.Interface;
|
|
8
|
-
uiService: UiService.Interface;
|
|
9
|
-
}
|
|
10
|
-
export declare class PrintInfoForEnv {
|
|
11
|
-
private di;
|
|
12
|
-
constructor(di: IPrintInfoForEnvDi);
|
|
13
|
-
execute(params: IPrintInfoForEnvParams): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
class PrintInfoForEnv {
|
|
3
|
-
constructor(di){
|
|
4
|
-
this.di = di;
|
|
5
|
-
}
|
|
6
|
-
async execute(params) {
|
|
7
|
-
if ("object" != typeof params || !params.env) throw new Error("Please provide an object with `env` and `variant` properties.");
|
|
8
|
-
const { getProjectSdkService, uiService } = this.di;
|
|
9
|
-
const projectSdk = await getProjectSdkService.execute();
|
|
10
|
-
const ui = uiService;
|
|
11
|
-
const { env, variant } = params;
|
|
12
|
-
const projectId = await projectSdk.getProjectId();
|
|
13
|
-
const resourcePrefix = await projectSdk.getPulumiResourceNamePrefix();
|
|
14
|
-
const api = await projectSdk.getAppStackOutput("api");
|
|
15
|
-
const admin = await projectSdk.getAppStackOutput("admin");
|
|
16
|
-
const outputs = [
|
|
17
|
-
api,
|
|
18
|
-
admin
|
|
19
|
-
];
|
|
20
|
-
const stacksDeployedCount = outputs.filter(Boolean).length;
|
|
21
|
-
if (0 === stacksDeployedCount) {
|
|
22
|
-
const variantMessage = variant ? ` and variant ${variant}` : "";
|
|
23
|
-
ui.info("It seems none of the stacks were deployed, so no info could be provided. Please check if the provided environment %s is correct.", `${env}${variantMessage}`);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const output = [];
|
|
27
|
-
output.push(`‣ Project ID: ${projectId ? chalk.blue(projectId) : "-"}`, `‣ Resource prefix: ${chalk.blue(resourcePrefix)}`);
|
|
28
|
-
if (api) output.push(`‣ Environment name: ${chalk.blue(env)}`, `‣ Environment variant name: ${variant ? chalk.blue(variant) : "-"}`, `‣ AWS region: ${api?.region}`, `‣ Main GraphQL API: ${api.apiUrl + "/graphql"}`, "‣ Headless CMS GraphQL API:", ` · Manage API: ${api.apiUrl + "/cms/manage"}`, ` · Read API: ${api.apiUrl + "/cms/read"}`, ` · Preview API: ${api.apiUrl + "/cms/preview"}`);
|
|
29
|
-
else output.push("‣ Environment name: -", "‣ Environment variant name: -", "‣ AWS region: -", "‣ Main GraphQL API: -", "‣ Headless CMS GraphQL API:", " · Manage API: -", " · Read API: -", " · Preview API: -");
|
|
30
|
-
if (admin && admin.appUrl) output.push(`‣ Admin app: ${admin.appUrl}`);
|
|
31
|
-
else output.push("‣ Admin app: -");
|
|
32
|
-
ui.text(output.join("\n"));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export { PrintInfoForEnv };
|
|
36
|
-
|
|
37
|
-
//# sourceMappingURL=PrintInfoForEnv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"features/InfoCommand/PrintInfoForEnv.js","sources":["../../../src/features/InfoCommand/PrintInfoForEnv.ts"],"sourcesContent":["import { GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\nimport chalk from \"chalk\";\n\nexport interface IPrintInfoForEnvParams {\n env: string;\n variant?: string;\n}\n\nexport interface IPrintInfoForEnvDi {\n getProjectSdkService: GetProjectSdkService.Interface;\n uiService: UiService.Interface;\n}\n\nexport class PrintInfoForEnv {\n constructor(private di: IPrintInfoForEnvDi) {}\n\n async execute(params: IPrintInfoForEnvParams) {\n if (typeof params !== \"object\" || !params.env) {\n throw new Error(\"Please provide an object with `env` and `variant` properties.\");\n }\n\n const { getProjectSdkService, uiService } = this.di;\n\n const projectSdk = await getProjectSdkService.execute();\n const ui = uiService;\n\n const { env, variant } = params;\n\n const projectId = await projectSdk.getProjectId();\n const resourcePrefix = await projectSdk.getPulumiResourceNamePrefix();\n\n const api = await projectSdk.getAppStackOutput(\"api\");\n\n const admin = await projectSdk.getAppStackOutput(\"admin\");\n\n const outputs = [api, admin];\n\n const stacksDeployedCount = outputs.filter(Boolean).length;\n\n if (stacksDeployedCount === 0) {\n const variantMessage = variant ? ` and variant ${variant}` : \"\";\n ui.info(\n [\n `It seems none of the stacks were deployed, so no info could be provided.`,\n `Please check if the provided environment %s is correct.`\n ].join(\" \"),\n `${env}${variantMessage}`\n );\n return;\n }\n\n const output = [];\n\n // Project info.\n output.push(\n `‣ Project ID: ${projectId ? chalk.blue(projectId) : \"-\"}`,\n `‣ Resource prefix: ${chalk.blue(resourcePrefix)}`\n );\n\n // API.\n if (api) {\n output.push(\n `‣ Environment name: ${chalk.blue(env)}`,\n `‣ Environment variant name: ${variant ? chalk.blue(variant) : \"-\"}`,\n `‣ AWS region: ${api?.region}`,\n `‣ Main GraphQL API: ${api.apiUrl + \"/graphql\"}`,\n `‣ Headless CMS GraphQL API:`,\n ` · Manage API: ${api.apiUrl + \"/cms/manage\"}`,\n ` · Read API: ${api.apiUrl + \"/cms/read\"}`,\n ` · Preview API: ${api.apiUrl + \"/cms/preview\"}`\n );\n } else {\n output.push(\n `‣ Environment name: -`,\n `‣ Environment variant name: -`,\n `‣ AWS region: -`,\n `‣ Main GraphQL API: -`,\n `‣ Headless CMS GraphQL API:`,\n ` · Manage API: -`,\n ` · Read API: -`,\n ` · Preview API: -`\n );\n }\n\n // Admin.\n if (admin && admin.appUrl) {\n output.push(`‣ Admin app: ${admin.appUrl}`);\n } else {\n output.push(`‣ Admin app: -`);\n }\n\n ui.text(output.join(\"\\n\"));\n }\n}\n"],"names":["PrintInfoForEnv","di","params","Error","getProjectSdkService","uiService","projectSdk","ui","env","variant","projectId","resourcePrefix","api","admin","outputs","stacksDeployedCount","Boolean","variantMessage","output","chalk"],"mappings":";AAaO,MAAMA;IACT,YAAoBC,EAAsB,CAAE;aAAxBA,EAAE,GAAFA;IAAyB;IAE7C,MAAM,QAAQC,MAA8B,EAAE;QAC1C,IAAI,AAAkB,YAAlB,OAAOA,UAAuB,CAACA,OAAO,GAAG,EACzC,MAAM,IAAIC,MAAM;QAGpB,MAAM,EAAEC,oBAAoB,EAAEC,SAAS,EAAE,GAAG,IAAI,CAAC,EAAE;QAEnD,MAAMC,aAAa,MAAMF,qBAAqB,OAAO;QACrD,MAAMG,KAAKF;QAEX,MAAM,EAAEG,GAAG,EAAEC,OAAO,EAAE,GAAGP;QAEzB,MAAMQ,YAAY,MAAMJ,WAAW,YAAY;QAC/C,MAAMK,iBAAiB,MAAML,WAAW,2BAA2B;QAEnE,MAAMM,MAAM,MAAMN,WAAW,iBAAiB,CAAC;QAE/C,MAAMO,QAAQ,MAAMP,WAAW,iBAAiB,CAAC;QAEjD,MAAMQ,UAAU;YAACF;YAAKC;SAAM;QAE5B,MAAME,sBAAsBD,QAAQ,MAAM,CAACE,SAAS,MAAM;QAE1D,IAAID,AAAwB,MAAxBA,qBAA2B;YAC3B,MAAME,iBAAiBR,UAAU,CAAC,aAAa,EAAEA,SAAS,GAAG;YAC7DF,GAAG,IAAI,CACH,oIAIA,GAAGC,MAAMS,gBAAgB;YAE7B;QACJ;QAEA,MAAMC,SAAS,EAAE;QAGjBA,OAAO,IAAI,CACP,CAAC,cAAc,EAAER,YAAYS,MAAM,IAAI,CAACT,aAAa,KAAK,EAC1D,CAAC,mBAAmB,EAAES,MAAM,IAAI,CAACR,iBAAiB;QAItD,IAAIC,KACAM,OAAO,IAAI,CACP,CAAC,oBAAoB,EAAEC,MAAM,IAAI,CAACX,MAAM,EACxC,CAAC,4BAA4B,EAAEC,UAAUU,MAAM,IAAI,CAACV,WAAW,KAAK,EACpE,CAAC,cAAc,EAAEG,KAAK,QAAQ,EAC9B,CAAC,oBAAoB,EAAEA,IAAI,MAAM,GAAG,YAAY,EAChD,+BACA,CAAC,iBAAiB,EAAEA,IAAI,MAAM,GAAG,eAAe,EAChD,CAAC,eAAe,EAAEA,IAAI,MAAM,GAAG,aAAa,EAC5C,CAAC,kBAAkB,EAAEA,IAAI,MAAM,GAAG,gBAAgB;aAGtDM,OAAO,IAAI,CACP,yBACA,iCACA,mBACA,yBACA,+BACA,sBACA,oBACA;QAKR,IAAIL,SAASA,MAAM,MAAM,EACrBK,OAAO,IAAI,CAAC,CAAC,aAAa,EAAEL,MAAM,MAAM,EAAE;aAE1CK,OAAO,IAAI,CAAC;QAGhBX,GAAG,IAAI,CAACW,OAAO,IAAI,CAAC;IACxB;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./InfoCommand.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./InfoCommand.js";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CliCommandFactory, GetProjectSdkService, UiService } from "../abstractions/index.js";
|
|
2
|
-
import { IBaseAppParams } from "../abstractions/features/types.js";
|
|
3
|
-
export type IOpenCommandParams = Omit<IBaseAppParams, "app">;
|
|
4
|
-
export declare class OpenCommand implements CliCommandFactory.Interface<IOpenCommandParams> {
|
|
5
|
-
private getProjectSdkService;
|
|
6
|
-
private uiService;
|
|
7
|
-
constructor(getProjectSdkService: GetProjectSdkService.Interface, uiService: UiService.Interface);
|
|
8
|
-
execute(): Promise<CliCommandFactory.CommandDefinition<IOpenCommandParams>>;
|
|
9
|
-
}
|
|
10
|
-
export declare const openCommand: import("@webiny/di").Implementation<typeof OpenCommand>;
|
package/features/OpenCommand.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { createImplementation } from "@webiny/di";
|
|
2
|
-
import { CliCommandFactory, GetProjectSdkService, UiService } from "../abstractions/index.js";
|
|
3
|
-
import { createBaseAppOptions } from "./common/index.js";
|
|
4
|
-
import open_0 from "open";
|
|
5
|
-
class OpenCommand {
|
|
6
|
-
constructor(getProjectSdkService, uiService){
|
|
7
|
-
this.getProjectSdkService = getProjectSdkService;
|
|
8
|
-
this.uiService = uiService;
|
|
9
|
-
}
|
|
10
|
-
async execute() {
|
|
11
|
-
const projectSdk = await this.getProjectSdkService.execute();
|
|
12
|
-
const ui = this.uiService;
|
|
13
|
-
return {
|
|
14
|
-
name: "open",
|
|
15
|
-
description: "Quickly open Admin application in your default browser",
|
|
16
|
-
options: [
|
|
17
|
-
...createBaseAppOptions(projectSdk, {
|
|
18
|
-
variant: {
|
|
19
|
-
description: "Variant of the app to watch"
|
|
20
|
-
}
|
|
21
|
-
}),
|
|
22
|
-
{
|
|
23
|
-
name: "json",
|
|
24
|
-
description: "Emit output as JSON",
|
|
25
|
-
type: "boolean"
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
handler: async ()=>{
|
|
29
|
-
ui.info("Opening %s...", "Admin app");
|
|
30
|
-
const appOutput = await projectSdk.getAppStackOutput("admin");
|
|
31
|
-
if (!appOutput) throw new Error('Could not retrieve URL for "Admin app". Please make sure you\'ve deployed the project first.');
|
|
32
|
-
const { appUrl } = appOutput;
|
|
33
|
-
if (!appUrl) throw new Error('Could not retrieve URL for "Admin app" ("appUrl" property missing). Please make sure you\'ve deployed the project first.');
|
|
34
|
-
return new Promise((resolve)=>{
|
|
35
|
-
setTimeout(()=>{
|
|
36
|
-
ui.success("Successfully opened %s.", "Admin app");
|
|
37
|
-
open_0(appUrl);
|
|
38
|
-
resolve();
|
|
39
|
-
}, 1000);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const openCommand = createImplementation({
|
|
46
|
-
abstraction: CliCommandFactory,
|
|
47
|
-
implementation: OpenCommand,
|
|
48
|
-
dependencies: [
|
|
49
|
-
GetProjectSdkService,
|
|
50
|
-
UiService
|
|
51
|
-
]
|
|
52
|
-
});
|
|
53
|
-
export { OpenCommand, openCommand };
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=OpenCommand.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils/ensureSameWebinyPackageVersions.js","sources":["../../src/utils/ensureSameWebinyPackageVersions.ts"],"sourcesContent":["import { execaSync } from \"execa\";\nimport chalk from \"chalk\";\n\nconst DEBUG_FLAG = \"--debug\";\nconst usingDebugFlag = process.argv.includes(DEBUG_FLAG);\n\nconst SKIP_WEBINY_VERSIONS_CHECK_FLAG = \"--no-package-versions-check\";\nconst skippingWebinyVersionsCheck = process.argv.includes(SKIP_WEBINY_VERSIONS_CHECK_FLAG);\n\nconst listWebinyPackageVersions = (): Map<string, Set<string>> => {\n const { stdout } = execaSync(\"yarn\", [\"info\", \"@webiny/*\", \"--name-only\", \"--all\", \"--json\"], {\n encoding: \"utf8\"\n });\n\n // Each line is a JSON string, so parse them individually.\n const lines = stdout\n .trim()\n .split(\"\\n\")\n .map(line => JSON.parse(line) as string);\n\n const versionMap = new Map<string, Set<string>>();\n\n for (const entry of lines) {\n // An example entry: \"@webiny/cli@npm:5.42.3\".\n const match = entry.match(/^(@webiny\\/[^@]+)@npm:(.+)$/);\n if (!match) {\n continue;\n }\n\n const [, pkg, version] = match;\n if (!versionMap.has(pkg)) {\n versionMap.set(pkg, new Set());\n }\n\n versionMap.get(pkg)!.add(version);\n }\n\n return versionMap;\n};\n\nexport const ensureSameWebinyPackageVersions = (): void => {\n // Just in case, we want to allow users to skip the check.\n if (skippingWebinyVersionsCheck) {\n return;\n }\n\n let webinyVersions: Map<string, Set<string>>;\n try {\n webinyVersions = listWebinyPackageVersions();\n } catch (e) {\n const message = [\"Failed to inspect Webiny package versions.\"];\n\n if (!usingDebugFlag) {\n message.push(`For more information, try running with ${chalk.yellow(DEBUG_FLAG)}.`);\n }\n\n message.push(\"Learn more: https://webiny.link/webiny-package-versions-check\");\n\n console.warn(chalk.yellow(message.join(\" \")));\n if (usingDebugFlag) {\n console.warn(e);\n }\n\n console.log();\n return;\n }\n\n const mismatchedPackages: Array<[string, Set<string>]> = [];\n for (const [pkg, versions] of webinyVersions.entries()) {\n if (versions.size > 1) {\n mismatchedPackages.push([pkg, versions]);\n }\n }\n\n if (mismatchedPackages.length > 0) {\n const message = [\n \"The following Webiny packages have mismatched versions:\",\n \"\",\n ...mismatchedPackages.map(([pkg, versions]) => {\n return `‣ ${pkg}: ${Array.from(versions).join(\", \")}`;\n }),\n \"\",\n `Please ensure all Webiny packages are using the same version. If you think this is a mistake, you can also skip this check by appending the ${chalk.red(\n SKIP_WEBINY_VERSIONS_CHECK_FLAG\n )} flag. Learn more: https://webiny.link/webiny-package-versions-check`\n ];\n\n console.error(chalk.red(message.join(\"\\n\")));\n process.exit(1);\n }\n};\n"],"names":["DEBUG_FLAG","usingDebugFlag","process","SKIP_WEBINY_VERSIONS_CHECK_FLAG","skippingWebinyVersionsCheck","listWebinyPackageVersions","stdout","execaSync","lines","line","JSON","versionMap","Map","entry","match","pkg","version","Set","ensureSameWebinyPackageVersions","webinyVersions","e","message","chalk","console","mismatchedPackages","versions","Array"],"mappings":";;AAGA,MAAMA,aAAa;AACnB,MAAMC,iBAAiBC,QAAQ,IAAI,CAAC,QAAQ,CAACF;AAE7C,MAAMG,kCAAkC;AACxC,MAAMC,8BAA8BF,QAAQ,IAAI,CAAC,QAAQ,CAACC;AAE1D,MAAME,4BAA4B;IAC9B,MAAM,EAAEC,MAAM,EAAE,GAAGC,UAAU,QAAQ;QAAC;QAAQ;QAAa;QAAe;QAAS;KAAS,EAAE;QAC1F,UAAU;IACd;IAGA,MAAMC,QAAQF,OACT,IAAI,GACJ,KAAK,CAAC,MACN,GAAG,CAACG,CAAAA,OAAQC,KAAK,KAAK,CAACD;IAE5B,MAAME,aAAa,IAAIC;IAEvB,KAAK,MAAMC,SAASL,MAAO;QAEvB,MAAMM,QAAQD,MAAM,KAAK,CAAC;QAC1B,IAAI,CAACC,OACD;QAGJ,MAAM,GAAGC,KAAKC,QAAQ,GAAGF;QACzB,IAAI,CAACH,WAAW,GAAG,CAACI,MAChBJ,WAAW,GAAG,CAACI,KAAK,IAAIE;QAG5BN,WAAW,GAAG,CAACI,KAAM,GAAG,CAACC;IAC7B;IAEA,OAAOL;AACX;AAEO,MAAMO,kCAAkC;IAE3C,IAAId,6BACA;IAGJ,IAAIe;IACJ,IAAI;QACAA,iBAAiBd;IACrB,EAAE,OAAOe,GAAG;QACR,MAAMC,UAAU;YAAC;SAA6C;QAE9D,IAAI,CAACpB,gBACDoB,QAAQ,IAAI,CAAC,CAAC,uCAAuC,EAAEC,MAAM,MAAM,CAACtB,YAAY,CAAC,CAAC;QAGtFqB,QAAQ,IAAI,CAAC;QAEbE,QAAQ,IAAI,CAACD,MAAM,MAAM,CAACD,QAAQ,IAAI,CAAC;QACvC,IAAIpB,gBACAsB,QAAQ,IAAI,CAACH;QAGjBG,QAAQ,GAAG;QACX;IACJ;IAEA,MAAMC,qBAAmD,EAAE;IAC3D,KAAK,MAAM,CAACT,KAAKU,SAAS,IAAIN,eAAe,OAAO,GAChD,IAAIM,SAAS,IAAI,GAAG,GAChBD,mBAAmB,IAAI,CAAC;QAACT;QAAKU;KAAS;IAI/C,IAAID,mBAAmB,MAAM,GAAG,GAAG;QAC/B,MAAMH,UAAU;YACZ;YACA;eACGG,mBAAmB,GAAG,CAAC,CAAC,CAACT,KAAKU,SAAS,GAC/B,CAAC,EAAE,EAAEV,IAAI,EAAE,EAAEW,MAAM,IAAI,CAACD,UAAU,IAAI,CAAC,OAAO;YAEzD;YACA,CAAC,4IAA4I,EAAEH,MAAM,GAAG,CACpJnB,iCACF,oEAAoE,CAAC;SAC1E;QAEDoB,QAAQ,KAAK,CAACD,MAAM,GAAG,CAACD,QAAQ,IAAI,CAAC;QACrCnB,QAAQ,IAAI,CAAC;IACjB;AACJ"}
|