@speedkit/cli 2.30.0 → 2.31.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,20 @@
1
+ # [2.31.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.30.1...v2.31.0) (2024-06-04)
2
+
3
+
4
+ ### Features
5
+
6
+ * **customer-config:** update exemplary enabled sites ([8bfd888](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/8bfd8885b978e227147aa4f5ac45b14e12bb03a3))
7
+
8
+ ## [2.30.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.30.0...v2.30.1) (2024-06-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **onboarding:** install resource regex ([3fe4ef9](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/3fe4ef9aadaedef45edd2a91f07ab8bb14b00687))
14
+ * **split-change-check:** allow void return type for active install resource getter ([ed39aab](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/ed39aab739b85830f8d5c1ef57d57b5b794beb7b))
15
+ * **split-change-check:** prevent deployment abort if origin do not exist yet ([32c722f](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/32c722f4c2af2c41a0a3bf6ee5aced3bb0b64c05))
16
+ * **split-change-check:** replace try catch with simple active install resource check ([d588122](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d588122a8dd91accde473c2b8eaedcfdb7b9460f))
17
+
1
18
  # [2.30.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.29.1...v2.30.0) (2024-05-29)
2
19
 
3
20
 
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.30.0 linux-x64 node-v20.14.0
24
+ @speedkit/cli/2.31.0 linux-x64 node-v20.14.0
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -50,10 +50,15 @@
50
50
  {
51
51
  pathname: [
52
52
  // TODO: adjust/replace this exemplary list
53
- {{#if isShopify}}
54
53
 
55
- "/collections/",
56
- "/products/",
54
+ /^\/$/, // Home
55
+
56
+ {{#if isShopify}}
57
+ "/collections/", // Category & PLP
58
+ "/products/", // PDP
59
+ {{else}}
60
+ "/c/", // Category & PLP
61
+ "/p/", // PDP
57
62
  {{/if}}
58
63
  ],
59
64
  },
@@ -22,21 +22,23 @@ class SplitChangeCheck {
22
22
  this.isProduction = isProduction;
23
23
  }
24
24
  async check() {
25
- this.cli.startAction("check SplitTestId");
26
25
  if (
27
- // do not check for others then production
26
+ // do not check for environments other than production
28
27
  !this.isProduction ||
29
- // check if we deploy a speedKitConfigFile
28
+ // do not check if speedKitConfigFile is not to be deployed
30
29
  !this.fileList.hasFile(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT) ||
31
- // check if we skipped the speedKitConfigFile
32
30
  this.fileList
33
31
  .getByName(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT)
34
32
  .shouldSkipFile()) {
35
- this.cli.endAction(cli_1.CliActionStatus.SKIPPED);
36
33
  return;
37
34
  }
38
- const speedKitConfigFile = this.fileList.getByName(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT);
39
35
  const activeInstallResource = await this.getActiveInstallResource();
36
+ // do not check if there is no active install resource to be updated
37
+ if (!activeInstallResource) {
38
+ return;
39
+ }
40
+ this.cli.startAction("Checking Split Test ID");
41
+ const speedKitConfigFile = this.fileList.getByName(files_1.INTEGRATION_FILES.CONFIG.SPEED_KIT);
40
42
  const activeSpeedKitConfig = activeInstallResource[speedKitConfigFile.remoteKey];
41
43
  const changesResponse = (0, safe_1.safe)(() => {
42
44
  return this.checkSplitsForEachOrigin(speedKitConfigFile, activeSpeedKitConfig);
@@ -132,7 +134,7 @@ class SplitChangeCheck {
132
134
  const activeInstallResourceResponse = await (0, safe_1.safe)(this.configApi.getActiveInstall(this.configName));
133
135
  if (activeInstallResourceResponse.success !== true) {
134
136
  this.cli.endAction(cli_1.CliActionStatus.FAILED);
135
- this.cli.writeError("Could not load active installResource");
137
+ this.cli.writeError("Could not load active install resource");
136
138
  this.cli.exit(1);
137
139
  return;
138
140
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CustomerDomainDocumentResponse = void 0;
4
+ const onboarding_model_1 = require("../onboarding-model");
4
5
  const origin_response_1 = require("../browser/origin-response");
5
6
  /**
6
7
  * Intercepts any request to the customersOrigin and equivalent requests to baqendAssetApi
@@ -109,7 +110,7 @@ class CustomerDomainDocumentResponse {
109
110
  return text.includes("speed-kit-dynamic");
110
111
  }
111
112
  rewriteInstallResource(text) {
112
- text = text.replace(/<script(?:.(?!<\/script>))*app\.baqend\.com\/v1\/speedkit\/install.js(?:.|(?!<\/script>))*<\/script>/, "");
113
+ text = text.replace(onboarding_model_1.SpeedKitInstallRegex, "");
113
114
  return text.replace(/<\s*head\b[^>]*>/, (head) => {
114
115
  return `${head}\n<script src="${this.customerConfig.installPath}" ${this.customerConfig.installParams}></script>`;
115
116
  });
@@ -73,3 +73,4 @@ export declare const USER_AGENT: {
73
73
  DESKTOP: string;
74
74
  MOBILE: string;
75
75
  };
76
+ export declare const SpeedKitInstallRegex: RegExp;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USER_AGENT = exports.OnboardingContext = exports.BrowserContext = void 0;
3
+ exports.SpeedKitInstallRegex = exports.USER_AGENT = exports.OnboardingContext = exports.BrowserContext = void 0;
4
4
  const core_1 = require("@oclif/core");
5
5
  const cli_parameters_1 = require("../../models/cli-parameters");
6
6
  const DEFAULT_BROWSER_ARGS = [
@@ -86,3 +86,4 @@ exports.USER_AGENT = {
86
86
  DESKTOP: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 (compatible; SpeedKit/1.0)",
87
87
  MOBILE: "Mozilla/5.0 (Linux; Android 7.1.1; ONEPLUS A5000 Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.107 Mobile Safari/537.36 (compatible; SpeedKit/1.0)",
88
88
  };
89
+ exports.SpeedKitInstallRegex = /<script(?:(?!<\/script>).)*app\.baqend\.com\/v1\/speedkit\/install.js(?:(?!<\/script>).)*<\/script>/s;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VirtualOrestesApp = void 0;
4
4
  const baqend_response_1 = require("../browser/baqend-response");
5
5
  const safe_1 = require("../../../helpers/safe");
6
+ const onboarding_model_1 = require("../onboarding-model");
6
7
  class VirtualOrestesApp {
7
8
  customerConfig;
8
9
  crawler;
@@ -181,7 +182,7 @@ class VirtualOrestesApp {
181
182
  return text.includes("<html");
182
183
  }
183
184
  rewriteInstallResource(text) {
184
- text = text.replace(/<script(?:.(?!<\/script>))*app\.baqend\.com\/v1\/speedkit\/install.js(?:.|(?!<\/script>))*<\/script>/, "");
185
+ text = text.replace(onboarding_model_1.SpeedKitInstallRegex, "");
185
186
  return text.replace(/<\s*head\b[^>]*>/, (head) => {
186
187
  return `${head}\n<script src="${this.customerConfig.installPath}" ${this.customerConfig.installParams}></script>`;
187
188
  });
@@ -675,5 +675,5 @@
675
675
  ]
676
676
  }
677
677
  },
678
- "version": "2.30.0"
678
+ "version": "2.31.0"
679
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.30.0",
4
+ "version": "2.31.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"