@speedkit/cli 2.29.1 → 2.30.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [2.30.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.29.1...v2.30.0) (2024-05-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * **onboarding:** optimise start domain handling ([4128094](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/4128094f16fc208085654e4b8fc84d44f7c85307))
7
+
1
8
  ## [2.29.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.29.0...v2.29.1) (2024-05-29)
2
9
 
3
10
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/2.29.1 linux-x64 node-v20.14.0
24
+ @speedkit/cli/2.30.0 linux-x64 node-v20.14.0
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -133,7 +133,7 @@ DESCRIPTION
133
133
  EXAMPLES
134
134
  $ sk build-parameter-query <customerPath> -c <configName>
135
135
 
136
- $ sk build-parameter-query customer/decathlon.de -c production
136
+ $ sk build-parameter-query customers/decathlon.de -c production
137
137
  ```
138
138
 
139
139
  ## `sk build-prewarm-query CUSTOMERPATH`
@@ -156,7 +156,7 @@ DESCRIPTION
156
156
  EXAMPLES
157
157
  $ sk build-prewarm-query <customerPath> -c <configName>
158
158
 
159
- $ sk build-prewarm-query customer/decathlon.de -c production
159
+ $ sk build-prewarm-query customers/decathlon.de -c production
160
160
  ```
161
161
 
162
162
  ## `sk deploy CUSTOMERPATH`
@@ -182,7 +182,7 @@ DESCRIPTION
182
182
  EXAMPLES
183
183
  $ sk deploy <customerPath> -c <configName> -t <slackToken> -a <artifacts> -d <dryRun>
184
184
 
185
- $ sk deploy customer/decathlon.de -c production -t someSlackToken -a dynamic,SpeedKit -d
185
+ $ sk deploy customers/decathlon.de -c production -t someSlackToken -a dynamic,SpeedKit -d
186
186
  ```
187
187
 
188
188
  ## `sk diff-url-parameters PAGEURL`
@@ -232,7 +232,7 @@ DESCRIPTION
232
232
  EXAMPLES
233
233
  $ sk documentHandler <customerPath> -c <configName>
234
234
 
235
- $ sk deploy customer/decathlon.de -c production
235
+ $ sk deploy customers/decathlon.de -c production
236
236
  ```
237
237
 
238
238
  ## `sk find-pops APP`
@@ -364,13 +364,14 @@ Start a local dev environment for building and testing the Speed Kit configurati
364
364
 
365
365
  ```
366
366
  USAGE
367
- $ sk onboarding CUSTOMERPATH [-c <value>] [-l] [-v] [-s]
367
+ $ sk onboarding CUSTOMERPATH [-c <value>] [-d <value>] [-l] [-v] [-s]
368
368
 
369
369
  ARGUMENTS
370
370
  CUSTOMERPATH The customer config path
371
371
 
372
372
  FLAGS
373
373
  -c, --configName=<value> [default: production] The costumer config name
374
+ -d, --domain=<value> Startup domain (optional)
374
375
  -l, --local Run with local documentHandler
375
376
  -s, --ignoreContentSecurityPolicy Removes header/meta "content-security-policy" for origin-responses
376
377
  -v, --verboseLevel Show all messages
@@ -379,9 +380,9 @@ DESCRIPTION
379
380
  Start a local dev environment for building and testing the Speed Kit configuration
380
381
 
381
382
  EXAMPLES
382
- $ sk onboarding <customerPath> -c <configName>
383
+ $ sk onboarding <customerPath> -c <configName> -d <domain>
383
384
 
384
- $ sk onboarding customer/decathlon.de -c production
385
+ $ sk onboarding customers/decathlon.de -c production -d www.decathlon.de
385
386
  ```
386
387
 
387
388
  ## `sk param-diff PAGEURL`
@@ -470,7 +471,7 @@ DESCRIPTION
470
471
  EXAMPLES
471
472
  $ sk pull <customerPath>
472
473
 
473
- $ sk pull customer/decathlon.de -c production
474
+ $ sk pull customers/decathlon.de -c production
474
475
  ```
475
476
 
476
477
  ## `sk wpt-launcher URLS TESTID`
@@ -9,12 +9,12 @@ class Onboarding extends core_1.Command {
9
9
  static flags = onboarding_1.OnboardingContext.flags;
10
10
  static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
11
11
  static examples = [
12
- `$ sk onboarding <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}>`,
13
- `$ sk onboarding ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName}`,
12
+ `$ sk onboarding <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}> -${cli_parameters_1.CLIParametersChar.Domain} <${cli_parameters_1.CLIParameters.Domain}>`,
13
+ `$ sk onboarding ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName} -${cli_parameters_1.CLIParametersChar.Domain} ${cli_parameters_1.CLIParametersExample.Domain}`,
14
14
  ];
15
15
  async run() {
16
- const { args: { customerPath }, flags: { configName, local, verboseLevel, ignoreContentSecurityPolicy }, } = await this.parse(Onboarding);
17
- const service = await new onboarding_1.OnboardingServiceFactory(new onboarding_1.OnboardingContext(customerPath, configName, local, verboseLevel, ignoreContentSecurityPolicy), new cli_config_1.CliConfig(this.config).load()).getService();
16
+ const { args: { customerPath }, flags: { configName, domain, local, verboseLevel, ignoreContentSecurityPolicy, }, } = await this.parse(Onboarding);
17
+ const service = await new onboarding_1.OnboardingServiceFactory(new onboarding_1.OnboardingContext(customerPath, configName, domain, local, verboseLevel, ignoreContentSecurityPolicy), new cli_config_1.CliConfig(this.config).load()).getService();
18
18
  await service.run();
19
19
  }
20
20
  }
@@ -8,6 +8,7 @@ export declare enum CLIParameters {
8
8
  CustomerPath = "customerPath",
9
9
  CustomersDirectory = "customersDirectory",
10
10
  Delay = "delay",
11
+ Domain = "domain",
11
12
  DryRun = "dryRun",
12
13
  Group = "group",
13
14
  HideDiff = "hideDiff",
@@ -33,6 +34,7 @@ export declare enum CLIParametersChar {
33
34
  CustomerPath = "p",
34
35
  CustomersDirectory = "d",
35
36
  Delay = "d",
37
+ Domain = "d",
36
38
  DryRun = "d",
37
39
  Group = "g",
38
40
  HideDiff = "h",
@@ -51,9 +53,10 @@ export declare enum CLIParametersExample {
51
53
  ConfigName = "production",
52
54
  ContentTypes = "image,style",
53
55
  Cookies = "consentCookies",
54
- CustomerPath = "customer/decathlon.de",
56
+ CustomerPath = "customers/decathlon.de",
55
57
  CustomersDirectory = "customers",
56
58
  Delay = "1200",
59
+ Domain = "www.decathlon.de",
57
60
  Group = "B",
58
61
  Ips = "151.101.120.194",
59
62
  Mobile = "Y",
@@ -13,6 +13,7 @@ var CLIParameters;
13
13
  CLIParameters["CustomerPath"] = "customerPath";
14
14
  CLIParameters["CustomersDirectory"] = "customersDirectory";
15
15
  CLIParameters["Delay"] = "delay";
16
+ CLIParameters["Domain"] = "domain";
16
17
  CLIParameters["DryRun"] = "dryRun";
17
18
  CLIParameters["Group"] = "group";
18
19
  CLIParameters["HideDiff"] = "hideDiff";
@@ -40,6 +41,7 @@ var CLIParametersChar;
40
41
  CLIParametersChar["CustomerPath"] = "p";
41
42
  CLIParametersChar["CustomersDirectory"] = "d";
42
43
  CLIParametersChar["Delay"] = "d";
44
+ CLIParametersChar["Domain"] = "d";
43
45
  CLIParametersChar["DryRun"] = "d";
44
46
  CLIParametersChar["Group"] = "g";
45
47
  CLIParametersChar["HideDiff"] = "h";
@@ -60,9 +62,10 @@ var CLIParametersExample;
60
62
  CLIParametersExample["ConfigName"] = "production";
61
63
  CLIParametersExample["ContentTypes"] = "image,style";
62
64
  CLIParametersExample["Cookies"] = "consentCookies";
63
- CLIParametersExample["CustomerPath"] = "customer/decathlon.de";
65
+ CLIParametersExample["CustomerPath"] = "customers/decathlon.de";
64
66
  CLIParametersExample["CustomersDirectory"] = "customers";
65
67
  CLIParametersExample["Delay"] = "1200";
68
+ CLIParametersExample["Domain"] = "www.decathlon.de";
66
69
  CLIParametersExample["Group"] = "B";
67
70
  CLIParametersExample["Ips"] = "151.101.120.194";
68
71
  CLIParametersExample["Mobile"] = "Y";
@@ -32,7 +32,7 @@ class CustomerConfig {
32
32
  }
33
33
  static createFrom(configFile, configName) {
34
34
  const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, } = configFile;
35
- return new CustomerConfig(new RequiredParameter("app", app).isString().getValue(), new RequiredParameter("origins", origins).isArray().getValue(), new RequiredParameter("domain", domain).isString().getValue(), new RequiredParameter("swPath", swPath).isString().getValue(), new RequiredParameter("scope", scope).isString().getValue(), appDomain || `${app}.app.baqend.com`, installPath ||
35
+ return new CustomerConfig(new RequiredParameter("app", app).isString().getValue(), new RequiredParameter("origins", origins).isArray().getValue(), domain, new RequiredParameter("swPath", swPath).isString().getValue(), new RequiredParameter("scope", scope).isString().getValue(), appDomain || `${app}.app.baqend.com`, installPath ||
36
36
  `https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall || true, chromeFlags, dependencies || {});
37
37
  }
38
38
  }
@@ -20,6 +20,7 @@ export interface FetchRequestPausedEventHandler {
20
20
  export declare class OnboardingContext {
21
21
  readonly customerPath: string;
22
22
  readonly configName: string;
23
+ readonly domain: string;
23
24
  readonly local: boolean;
24
25
  readonly verboseLevel?: boolean;
25
26
  readonly ignoreContentSecurityPolicy: boolean;
@@ -28,7 +29,7 @@ export declare class OnboardingContext {
28
29
  readonly DEFAULT_DOCUMENT_HANDLER_PATH = "https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js";
29
30
  readonly DEFAULT_SNIPPET_PATH = "https://www.baqend.com/speed-kit/latest/snippet.js";
30
31
  readonly DEFAULT_SW_PATH = "https://www.baqend.com/speed-kit/latest/sw.js";
31
- constructor(customerPath: string, configName: string, local: boolean, verboseLevel?: boolean, ignoreContentSecurityPolicy?: boolean);
32
+ constructor(customerPath: string, configName: string, domain: string, local: boolean, verboseLevel?: boolean, ignoreContentSecurityPolicy?: boolean);
32
33
  }
33
34
  export type SpeedKitServerConfigAuthentication = {
34
35
  password: string;
@@ -42,11 +42,16 @@ exports.BrowserContext = BrowserContext;
42
42
  class OnboardingContext {
43
43
  customerPath;
44
44
  configName;
45
+ domain;
45
46
  local;
46
47
  verboseLevel;
47
48
  ignoreContentSecurityPolicy;
48
49
  static flags = {
49
50
  ...cli_parameters_1.CLI_CONFIG_NAME,
51
+ [cli_parameters_1.CLIParameters.Domain]: core_1.Flags.string({
52
+ char: cli_parameters_1.CLIParametersChar.Domain,
53
+ description: "Startup domain (optional)",
54
+ }),
50
55
  local: core_1.Flags.boolean({
51
56
  char: "l",
52
57
  default: false,
@@ -67,9 +72,10 @@ class OnboardingContext {
67
72
  DEFAULT_DOCUMENT_HANDLER_PATH = "https://www.baqend.com/speed-kit-handler/latest/DocumentHandler.js";
68
73
  DEFAULT_SNIPPET_PATH = "https://www.baqend.com/speed-kit/latest/snippet.js";
69
74
  DEFAULT_SW_PATH = "https://www.baqend.com/speed-kit/latest/sw.js";
70
- constructor(customerPath, configName, local, verboseLevel, ignoreContentSecurityPolicy = false) {
75
+ constructor(customerPath, configName, domain, local, verboseLevel, ignoreContentSecurityPolicy = false) {
71
76
  this.customerPath = customerPath;
72
77
  this.configName = configName;
78
+ this.domain = domain;
73
79
  this.local = local;
74
80
  this.verboseLevel = verboseLevel;
75
81
  this.ignoreContentSecurityPolicy = ignoreContentSecurityPolicy;
@@ -13,4 +13,5 @@ export declare class OnboardingServiceFactory {
13
13
  private getSpeedKitServerConfig;
14
14
  private getIntegrationFiles;
15
15
  private getUrlForTest;
16
+ private ensureHttps;
16
17
  }
@@ -147,13 +147,23 @@ class OnboardingServiceFactory {
147
147
  ]);
148
148
  }
149
149
  async getUrlForTest(customerConfig, cli) {
150
- let domainToStart = customerConfig.origins[0];
151
- if (customerConfig.origins.length > 1) {
152
- domainToStart = await cli.select("select domain to start", customerConfig.origins.map((origin) => {
153
- return { name: origin, value: origin };
154
- }));
150
+ // Consider startup domain based on the following priority:
151
+ // 1. domain flag (-d)
152
+ // 2. customerConfig.domain
153
+ // 3. customerConfig.origins (prompt selection if more than 1 entry)
154
+ let domainToStart = this.context.domain || customerConfig.domain;
155
+ if (!domainToStart) {
156
+ domainToStart = customerConfig.origins[0];
157
+ if (customerConfig.origins.length > 1) {
158
+ domainToStart = await cli.select("Select domain to start", customerConfig.origins.map((origin) => {
159
+ return { name: origin, value: origin };
160
+ }));
161
+ }
155
162
  }
156
- return domainToStart;
163
+ return this.ensureHttps(domainToStart);
164
+ }
165
+ ensureHttps(url = "") {
166
+ return url.startsWith("https://") ? url : `https://${url}`;
157
167
  }
158
168
  }
159
169
  exports.OnboardingServiceFactory = OnboardingServiceFactory;
@@ -12,7 +12,7 @@
12
12
  "description": "Build a parameter query that can be executed in Athena",
13
13
  "examples": [
14
14
  "$ sk build-parameter-query <customerPath> -c <configName>",
15
- "$ sk build-parameter-query customer/decathlon.de -c production"
15
+ "$ sk build-parameter-query customers/decathlon.de -c production"
16
16
  ],
17
17
  "flags": {
18
18
  "configName": {
@@ -52,7 +52,7 @@
52
52
  "description": "Build a prewarm query that can be executed in Athena",
53
53
  "examples": [
54
54
  "$ sk build-prewarm-query <customerPath> -c <configName>",
55
- "$ sk build-prewarm-query customer/decathlon.de -c production"
55
+ "$ sk build-prewarm-query customers/decathlon.de -c production"
56
56
  ],
57
57
  "flags": {
58
58
  "configName": {
@@ -92,7 +92,7 @@
92
92
  "description": "Deploys the specified customer config while comparing to the live version before",
93
93
  "examples": [
94
94
  "$ sk deploy <customerPath> -c <configName> -t <slackToken> -a <artifacts> -d <dryRun>",
95
- "$ sk deploy customer/decathlon.de -c production -t someSlackToken -a dynamic,SpeedKit -d"
95
+ "$ sk deploy customers/decathlon.de -c production -t someSlackToken -a dynamic,SpeedKit -d"
96
96
  ],
97
97
  "flags": {
98
98
  "configName": {
@@ -196,7 +196,7 @@
196
196
  "description": "Creates testable documentHandler in folder {CUSTOMER_PATH}/test/src/",
197
197
  "examples": [
198
198
  "$ sk documentHandler <customerPath> -c <configName>",
199
- "$ sk deploy customer/decathlon.de -c production"
199
+ "$ sk deploy customers/decathlon.de -c production"
200
200
  ],
201
201
  "flags": {
202
202
  "configName": {
@@ -433,8 +433,8 @@
433
433
  },
434
434
  "description": "Start a local dev environment for building and testing the Speed Kit configuration",
435
435
  "examples": [
436
- "$ sk onboarding <customerPath> -c <configName>",
437
- "$ sk onboarding customer/decathlon.de -c production"
436
+ "$ sk onboarding <customerPath> -c <configName> -d <domain>",
437
+ "$ sk onboarding customers/decathlon.de -c production -d www.decathlon.de"
438
438
  ],
439
439
  "flags": {
440
440
  "configName": {
@@ -446,6 +446,14 @@
446
446
  "multiple": false,
447
447
  "type": "option"
448
448
  },
449
+ "domain": {
450
+ "char": "d",
451
+ "description": "Startup domain (optional)",
452
+ "name": "domain",
453
+ "hasDynamicHelp": false,
454
+ "multiple": false,
455
+ "type": "option"
456
+ },
449
457
  "local": {
450
458
  "char": "l",
451
459
  "description": "Run with local documentHandler",
@@ -579,7 +587,7 @@
579
587
  "description": "Pull the specified customer config from orestes",
580
588
  "examples": [
581
589
  "$ sk pull <customerPath>",
582
- "$ sk pull customer/decathlon.de -c production"
590
+ "$ sk pull customers/decathlon.de -c production"
583
591
  ],
584
592
  "flags": {
585
593
  "configName": {
@@ -667,5 +675,5 @@
667
675
  ]
668
676
  }
669
677
  },
670
- "version": "2.29.1"
678
+ "version": "2.30.0"
671
679
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.29.1",
4
+ "version": "2.30.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"