@webiny/cli 5.42.4-beta.0 → 5.43.0-beta.1

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/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- import { CliContext } from "./types";
1
+ import {CliContext} from "./types";
2
+
3
+ export * from "./regions"
2
4
 
3
5
  export declare const cli: CliContext;
package/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  const context = require("./context");
2
+ const regions = require("./regions");
2
3
 
3
4
  module.exports.cli = context;
5
+ module.exports.regions = regions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/cli",
3
- "version": "5.42.4-beta.0",
3
+ "version": "5.43.0-beta.1",
4
4
  "main": "index.js",
5
5
  "bin": {
6
6
  "webiny": "./bin.js"
@@ -13,12 +13,13 @@
13
13
  "author": "Pavel Denisjuk <pavel@webiny.com>",
14
14
  "description": "A tool to bootstrap a Webiny project.",
15
15
  "dependencies": {
16
- "@webiny/system-requirements": "5.42.4-beta.0",
17
- "@webiny/telemetry": "5.42.4-beta.0",
18
- "@webiny/wcp": "5.42.4-beta.0",
16
+ "@webiny/system-requirements": "5.43.0-beta.1",
17
+ "@webiny/telemetry": "5.43.0-beta.1",
18
+ "@webiny/wcp": "5.43.0-beta.1",
19
19
  "boolean": "3.2.0",
20
20
  "camelcase": "6.3.0",
21
21
  "chalk": "4.1.2",
22
+ "ci-info": "4.1.0",
22
23
  "dotenv": "8.6.0",
23
24
  "execa": "5.1.1",
24
25
  "fast-glob": "3.2.12",
@@ -26,13 +27,12 @@
26
27
  "fs-extra": "11.2.0",
27
28
  "graphql-request": "3.7.0",
28
29
  "inquirer": "8.2.6",
29
- "is-ci": "3.0.1",
30
30
  "ncp": "2.0.0",
31
31
  "open": "8.4.2",
32
32
  "pirates": "4.0.6",
33
33
  "semver": "7.6.3",
34
34
  "ts-morph": "11.0.3",
35
- "typescript": "4.9.5",
35
+ "typescript": "5.3.3",
36
36
  "uniqid": "5.4.0",
37
37
  "yargs": "17.7.2"
38
38
  },
@@ -66,5 +66,5 @@
66
66
  ]
67
67
  }
68
68
  },
69
- "gitHead": "89f483f705c33e9c8adaf1967d1ca77bbca9f201"
69
+ "gitHead": "d47a234b09383cb7ab2d9907300b8eaa89aa64d6"
70
70
  }
package/regions.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export interface RegionValue {
2
+ name: string;
3
+ value: string;
4
+ }
5
+
6
+ export declare const regions: RegionValue[];
package/regions.js ADDED
@@ -0,0 +1,30 @@
1
+ const regions = [
2
+ { value: "us-east-1", name: "us-east-1 (US East, N. Virginia)" },
3
+ { value: "us-east-2", name: "us-east-2 (US East, Ohio)" },
4
+ { value: "us-west-1", name: "us-west-1 (US West, N. California)" },
5
+ { value: "us-west-2", name: "us-west-2 (US West, Oregon)" },
6
+ { value: "ca-central-1", name: "ca-central-1 (Canada, Central)" },
7
+ { value: "eu-central-1", name: "eu-central-1 (EU, Frankfurt)" },
8
+ { value: "eu-west-1", name: "eu-west-1 (EU, Ireland)" },
9
+ { value: "eu-west-2", name: "eu-west-2 (EU, London)" },
10
+ /**
11
+ * This was commented out because cognito was not available in this region in 2021.
12
+ * TODO - uncomment and test it out
13
+ */
14
+ /*{ value: "eu-south-1", name: "eu-south-1 (EU, Milan)" },*/
15
+ { value: "eu-west-3", name: "eu-west-3 (EU, Paris)" },
16
+ { value: "eu-north-1", name: "eu-north-1 (EU, Stockholm)" },
17
+ { value: "af-south-1", name: "af-south-1 (Africa, Cape Town)" },
18
+ { value: "ap-east-1", name: "ap-east-1 (Asia Pacific, Hong Kong)" },
19
+ { value: "ap-south-1", name: "ap-south-1 (Asia Pacific, Mumbai)" },
20
+ { value: "ap-northeast-2", name: "ap-northeast-2 (Asia Pacific, Seoul)" },
21
+ { value: "ap-southeast-1", name: "ap-southeast-1 (Asia Pacific, Singapore)" },
22
+ { value: "ap-southeast-2", name: "ap-southeast-2 (Asia Pacific, Sydney)" },
23
+ { value: "ap-northeast-1", name: "ap-northeast-1 (Asia Pacific, Tokyo)" },
24
+ // { value: "me-south-1", name: "me-south-1 (Middle East, Bahrain)" },
25
+ { value: "sa-east-1", name: "sa-east-1 (South America, São Paulo)" }
26
+ ];
27
+
28
+ module.exports = {
29
+ regions
30
+ };
package/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type yargs from "yargs";
2
+
1
3
  /**
2
4
  * Rename file to types.ts when switching the package to Typescript.
3
5
  */
@@ -10,6 +12,7 @@ export type NonEmptyArray<T> = [T, ...T[]];
10
12
  * Not in relation with "@webiny/plugins" package.
11
13
  */
12
14
  export interface PluginsContainer {
15
+ register(...args: any[]): void;
13
16
  byType<T extends Plugin>(type: T["type"]): T[];
14
17
 
15
18
  byName<T extends Plugin>(name: T["name"]): T;
@@ -34,13 +37,41 @@ interface Project {
34
37
  /**
35
38
  * Configurations.
36
39
  */
37
- config: Record<string, any>;
40
+ config: {
41
+ appAliases: {
42
+ [key: string]: string;
43
+ }
44
+ [key: string]: any;
45
+ };
38
46
  /**
39
47
  * Root path of the project.
40
48
  */
41
49
  root: string;
42
50
  }
43
51
 
52
+
53
+ export interface IProjectApplicationPackage {
54
+ name: string;
55
+ paths: {
56
+ root: string;
57
+ relative: string;
58
+ packageJson: string;
59
+ config: string;
60
+ };
61
+ packageJson: Record<string, any>;
62
+ get config(): any;
63
+ }
64
+
65
+ export interface IProjectApplicationConfigCli {
66
+ watch?: boolean;
67
+ }
68
+
69
+ export interface IProjectApplicationConfig {
70
+ appAliases?: Record<string, string>;
71
+ cli?: IProjectApplicationConfigCli;
72
+ [key: string]: unknown
73
+ }
74
+
44
75
  export interface ProjectApplication {
45
76
  /**
46
77
  * Unique ID of the project application.
@@ -73,7 +104,7 @@ export interface ProjectApplication {
73
104
  /**
74
105
  * Project application config (exported via `webiny.application.ts` file).
75
106
  */
76
- config: Record<string, any>;
107
+ config: IProjectApplicationConfig;
77
108
  /**
78
109
  * Project application package.json.
79
110
  */
@@ -82,16 +113,7 @@ export interface ProjectApplication {
82
113
  /**
83
114
  * A list of all the packages in the project application.
84
115
  */
85
- get packages(): Array<{
86
- name: string;
87
- paths: {
88
- root: string;
89
- packageJson: string;
90
- config: string;
91
- };
92
- packageJson: Record<string, any>;
93
- get config(): any;
94
- }>;
116
+ get packages(): IProjectApplicationPackage[];
95
117
  }
96
118
 
97
119
  /**
@@ -112,6 +134,10 @@ export interface CliContext {
112
134
  * All registered plugins.
113
135
  */
114
136
  plugins: PluginsContainer;
137
+ /**
138
+ * Load environment variables from a given file.
139
+ */
140
+ loadEnv(filePath: string, options?: {debug?: boolean}): Promise<void>;
115
141
  /**
116
142
  * All the environment variables.
117
143
  */
@@ -166,7 +192,7 @@ export interface CliContext {
166
192
  * Only trivial data should be passed here, specific to the current project.
167
193
  */
168
194
  localStorage: {
169
- set: (key: string, value: string) => Record<string, any>;
195
+ set: (key: string, value: any) => Record<string, any>;
170
196
  get: (key: string) => any;
171
197
  };
172
198
  }
@@ -177,7 +203,7 @@ export interface CliContext {
177
203
  * @category Cli
178
204
  */
179
205
  export interface CliCommandPluginArgs {
180
- yargs: any;
206
+ yargs: typeof yargs;
181
207
  context: CliContext;
182
208
  }
183
209
 
@@ -192,3 +218,17 @@ export interface CliCommandPlugin extends Plugin {
192
218
  name: string;
193
219
  create: (args: CliCommandPluginArgs) => void;
194
220
  }
221
+
222
+ export interface CliCommandErrorPluginHandleParams {
223
+ context: CliContext;
224
+ error: Error;
225
+ }
226
+
227
+ export interface CliCommandErrorPluginHandle {
228
+ (params: CliCommandErrorPluginHandleParams):void;
229
+ }
230
+
231
+ export interface CliCommandErrorPlugin extends Plugin {
232
+ type: "cli-command-error";
233
+ handle: CliCommandErrorPluginHandle;
234
+ }
@@ -0,0 +1,28 @@
1
+ import { Project, ProjectApplication } from "../types";
2
+
3
+ export interface IGetProjectParams {
4
+ cwd: string;
5
+ }
6
+
7
+ export declare function getProject(params?: IGetProjectParams): Project;
8
+
9
+ export interface IGetProjectApplicationParams {
10
+ cwd: string;
11
+ }
12
+
13
+ export declare function getProjectApplication(
14
+ params: IGetProjectApplicationParams
15
+ ): ProjectApplication;
16
+
17
+ export declare function sendEvent(event: string, properties?: Record<string, any>): Promise<void>;
18
+
19
+ export declare function sleepSync(ms?: number): void;
20
+
21
+ export declare const log: {
22
+ log: ((...args: any[]) => void) & { hl: (message: string) => string };
23
+ info: ((...args: any[]) => void) & { hl: (message: string) => string };
24
+ success: ((...args: any[]) => void) & { hl: (message: string) => string };
25
+ debug: ((...args: any[]) => void) & { hl: (message: string) => string };
26
+ warning: ((...args: any[]) => void) & { hl: (message: string) => string };
27
+ error: ((...args: any[]) => void) & { hl: (message: string) => string };
28
+ };