@speedkit/cli 2.47.1 → 2.48.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 +9 -0
- package/README.md +1 -1
- package/dist/services/customer-config/customer-config-service-model.d.ts +1 -0
- package/dist/services/customer-config/customer-config-service.d.ts +1 -0
- package/dist/services/customer-config/customer-config-service.js +14 -1
- package/dist/services/customer-config/templates/config_SpeedKit.js.hbs +12 -0
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +7 -0
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# [2.48.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.47.1...v2.48.0) (2024-07-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **config-wizard:** add support for scrapingbee ([c8fe5a1](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/c8fe5a1b45c06fc373cbf868ef6fb6204cadc0fc))
|
|
7
|
+
* **config-wizard:** add support for scrapingbee ([1286550](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/1286550a41fd48a0effee9c4c8f5b424dc8cb864))
|
|
8
|
+
* **config-wizard:** add support for scrapingbee ([f1a6ba3](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/f1a6ba3dcf42ee5715943e5c7a923464c81b77db))
|
|
9
|
+
|
|
1
10
|
## [2.47.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.47.0...v2.47.1) (2024-07-24)
|
|
2
11
|
|
|
3
12
|
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ export interface CustomerConfigSettings {
|
|
|
32
32
|
shadowDomCustomElementPrefix?: string;
|
|
33
33
|
activateRumTracking?: boolean;
|
|
34
34
|
useGATracking?: boolean;
|
|
35
|
+
useScrapingBee?: boolean;
|
|
35
36
|
withGoogleOptimize?: boolean;
|
|
36
37
|
activateCfRocketLoaderWorkaround?: boolean;
|
|
37
38
|
isShopify?: boolean;
|
|
@@ -24,5 +24,6 @@ export declare class CustomerConfigService {
|
|
|
24
24
|
private downloadAndSaveFile;
|
|
25
25
|
private getConfigSettings;
|
|
26
26
|
handleDocumentHandler({ addPreRendering }: CustomerConfigSettings): Promise<void>;
|
|
27
|
+
logWarnings(configSettings: CustomerConfigSettings): Promise<void>;
|
|
27
28
|
generateConfig(): Promise<void>;
|
|
28
29
|
}
|
|
@@ -161,7 +161,7 @@ class CustomerConfigService {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
async getConfigSettings() {
|
|
164
|
-
let { production, staging, subRouteScope, includeServiceWorker, activateImageOptimisation, removeLazyLoading, addPreRendering, supportShadowDomInPreRendering, shadowDomCustomElementPrefix, activateRumTracking, useGATracking, withGoogleOptimize, activateCfRocketLoaderWorkaround, isShopify, isShopware, isSalesforce, isPlentymarkets, shopifyId, } = {};
|
|
164
|
+
let { production, staging, subRouteScope, includeServiceWorker, activateImageOptimisation, removeLazyLoading, addPreRendering, supportShadowDomInPreRendering, shadowDomCustomElementPrefix, activateRumTracking, useGATracking, useScrapingBee, withGoogleOptimize, activateCfRocketLoaderWorkaround, isShopify, isShopware, isSalesforce, isPlentymarkets, shopifyId, } = {};
|
|
165
165
|
this.appName = await this.cli.prompt(`Enter SK App Name:`, {
|
|
166
166
|
validator: (input) => /^[\da-z]+(?:-[\da-z]+)*$/.test(input) ? "" : "No valid kebab-case",
|
|
167
167
|
defaultAnswer: this.appName,
|
|
@@ -214,6 +214,7 @@ class CustomerConfigService {
|
|
|
214
214
|
shadowDomCustomElementPrefix = await this.cli.prompt("Please specify the prefix of the custom elements used (e.g. o2 uses tef-): ", { defaultAnswer: "custom-" });
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
+
useScrapingBee = await this.cli.confirm("Do customer responses differ geo-location-based (ScrapingBee will be needed to fetch documents)?", false);
|
|
217
218
|
activateRumTracking = await this.cli.confirm("Activate RUM Tracking?");
|
|
218
219
|
if (activateRumTracking && !isShopify) {
|
|
219
220
|
useGATracking = await this.cli.confirm("Add Tracking based on Google Analytics' DataLayer?");
|
|
@@ -235,6 +236,7 @@ class CustomerConfigService {
|
|
|
235
236
|
shadowDomCustomElementPrefix,
|
|
236
237
|
activateRumTracking,
|
|
237
238
|
useGATracking,
|
|
239
|
+
useScrapingBee,
|
|
238
240
|
withGoogleOptimize,
|
|
239
241
|
activateCfRocketLoaderWorkaround,
|
|
240
242
|
isShopify,
|
|
@@ -269,6 +271,16 @@ class CustomerConfigService {
|
|
|
269
271
|
`);
|
|
270
272
|
}
|
|
271
273
|
}
|
|
274
|
+
async logWarnings(configSettings) {
|
|
275
|
+
if (configSettings.useScrapingBee) {
|
|
276
|
+
this.cli.writeWarning(`
|
|
277
|
+
⚠️ MANUAL ACTION NEEDED ⚠️
|
|
278
|
+
|
|
279
|
+
Remember to set it up the variation in the orestes config.
|
|
280
|
+
See more info here: https://www.notion.so/baqend/How-to-use-Scraping-Bee-in-the-orestes-config-b94d8571e1a04c9e8310810df55a9a62
|
|
281
|
+
`);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
272
284
|
async generateConfig() {
|
|
273
285
|
this.cli.write("\nLet's generate a config...\n");
|
|
274
286
|
const configSettings = await this.getConfigSettings();
|
|
@@ -278,6 +290,7 @@ class CustomerConfigService {
|
|
|
278
290
|
}
|
|
279
291
|
await this.compileHandlebarsFiles(configSettings);
|
|
280
292
|
await this.handleDocumentHandler(configSettings);
|
|
293
|
+
await this.logWarnings(configSettings);
|
|
281
294
|
this.cli.writeSuccess("\nConfig generation completed 👏\n");
|
|
282
295
|
}
|
|
283
296
|
}
|
|
@@ -74,6 +74,18 @@
|
|
|
74
74
|
split: CURRENT_HOST_CONFIG.split,
|
|
75
75
|
splitTestId: CURRENT_HOST_CONFIG.splitTestId,
|
|
76
76
|
disabled: !CURRENT_HOST_CONFIG.enabled{{#if addPreRendering}} || isTablet(){{/if}},
|
|
77
|
+
{{#if useScrapingBee}}
|
|
78
|
+
customVariation: [
|
|
79
|
+
{
|
|
80
|
+
variationFunction: function (request, device, cookies) {
|
|
81
|
+
if (device === "desktop") {
|
|
82
|
+
return "proxycrawl";
|
|
83
|
+
}
|
|
84
|
+
return "proxycrawlmobile";
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
{{/if}}
|
|
77
89
|
enabledSites: [
|
|
78
90
|
{
|
|
79
91
|
pathname: [
|
|
@@ -56,6 +56,13 @@ const config = {
|
|
|
56
56
|
return `Tablet viewport is unsupported: ${url}`;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
{{/if}}
|
|
60
|
+
{{#if useScrapingBee}}
|
|
61
|
+
// dynamically blacklist not 200 status codes from ScrapingBee
|
|
62
|
+
const spbStatusCode = headers["Spb-initial-status-code"];
|
|
63
|
+
if (spbStatusCode && spbStatusCode !== "200") {
|
|
64
|
+
return `initial status code unequal to 200 received from scrapingbee: ${url} ${spbStatusCode}`;
|
|
65
|
+
}
|
|
59
66
|
{{/if}}
|
|
60
67
|
return false;
|
|
61
68
|
},
|
package/oclif.manifest.json
CHANGED