@speedkit/cli 2.67.0 → 2.68.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 +13 -0
- package/README.md +1 -1
- package/dist/services/customer-config/customer-config-service.d.ts +0 -1
- package/dist/services/customer-config/customer-config-service.js +1 -27
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +1 -1
- package/dist/services/document-handler-runtime/document-handler-server.d.ts +3 -1
- package/dist/services/document-handler-runtime/document-handler-server.js +6 -1
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +4 -1
- package/dist/services/integration-api/struct/customer-config.js +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# [2.68.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.67.0...v2.68.0) (2024-12-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* do not set forceInstall to true by default ([4cd7138](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/4cd7138e2deb44a8a33920c3fa888a77401dcd2c))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **onboarding:** add current DBToken to local docHandlerRuntime ([bd7d164](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/bd7d16420dd3bab22f76d34878ddfdfc2a0edc03))
|
|
12
|
+
* **wizard:** remove custom doc-handler creation on lambda server-side rendering usage ([a4f5bff](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/a4f5bff6591e376a089c6f9acb70239fce133eac))
|
|
13
|
+
|
|
1
14
|
# [2.67.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.66.0...v2.67.0) (2024-12-10)
|
|
2
15
|
|
|
3
16
|
|
package/README.md
CHANGED
|
@@ -23,7 +23,6 @@ export declare class CustomerConfigService {
|
|
|
23
23
|
private shouldFileBeOverwritten;
|
|
24
24
|
private downloadAndSaveFile;
|
|
25
25
|
private getConfigSettings;
|
|
26
|
-
handleDocumentHandler({ addPreRendering }: CustomerConfigSettings): Promise<void>;
|
|
27
26
|
logWarnings(configSettings: CustomerConfigSettings): Promise<void>;
|
|
28
27
|
generateConfig(): Promise<void>;
|
|
29
28
|
}
|
|
@@ -207,7 +207,7 @@ class CustomerConfigService {
|
|
|
207
207
|
}
|
|
208
208
|
activateImageOptimisation = await this.cli.confirm("Activate Image Optimisation?", false);
|
|
209
209
|
removeLazyLoading = await this.cli.confirm("Remove Lazy-Loading?");
|
|
210
|
-
if (await this.cli.confirm("Add Pre-Rendering? This requires a set-up Lambda function to work. Also requires
|
|
210
|
+
if (await this.cli.confirm("Add Pre-Rendering? This requires a set-up Lambda function to work. Also requires usage of the DOM-based DocumentHandler.", false)) {
|
|
211
211
|
addPreRendering = true;
|
|
212
212
|
if (await this.cli.confirm("Does the customer utilize Shadow DOMs? If so additional handling for this will be added.", false)) {
|
|
213
213
|
supportShadowDomInPreRendering = true;
|
|
@@ -250,31 +250,6 @@ class CustomerConfigService {
|
|
|
250
250
|
shopifyId,
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
-
async handleDocumentHandler({ addPreRendering }) {
|
|
254
|
-
/*
|
|
255
|
-
TODO:
|
|
256
|
-
remove this custom DocumentHandler handling as soon as the DOM-parsing DocumentHandler has been released
|
|
257
|
-
and can be controlled/activated by the DocumentHandler Config properly
|
|
258
|
-
*/
|
|
259
|
-
if (addPreRendering) {
|
|
260
|
-
const documentHandlerBranchName = "dom-parser/develop";
|
|
261
|
-
const customDocumentHandlerOutputPath = path.join(this.outputDirPath, "custom_documentHandler.js");
|
|
262
|
-
this.cli.writeWarning(`
|
|
263
|
-
⚠️ MANUAL ACTION NEEDED ⚠️
|
|
264
|
-
|
|
265
|
-
Your config needs the DOM-parsing DocumentHandler which has not been publicly released yet.
|
|
266
|
-
|
|
267
|
-
Working Branch: ${this.cli.codeStyle(documentHandlerBranchName)} (https://gitlab.orestes.info/baqend/document-handler/-/tree/${documentHandlerBranchName})
|
|
268
|
-
|
|
269
|
-
Please add it to your newly created config directory manually:
|
|
270
|
-
|
|
271
|
-
1. ${this.cli.codeStyle(`git clone -b ${documentHandlerBranchName} git@vm.orestes.info:baqend/document-handler.git`)}
|
|
272
|
-
2. ${this.cli.codeStyle(`cd ./document-handler`)}
|
|
273
|
-
3. ${this.cli.codeStyle(`npm ci && npm run build`)}
|
|
274
|
-
4. ${this.cli.codeStyle(`cp ./dist/DocumentHandler.js ${customDocumentHandlerOutputPath}`)}
|
|
275
|
-
`);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
253
|
async logWarnings(configSettings) {
|
|
279
254
|
if (configSettings.useScrapingBee) {
|
|
280
255
|
this.cli.writeWarning(`
|
|
@@ -293,7 +268,6 @@ class CustomerConfigService {
|
|
|
293
268
|
this.templates.push("downtimeDetection.js.hbs");
|
|
294
269
|
}
|
|
295
270
|
await this.compileHandlebarsFiles(configSettings);
|
|
296
|
-
await this.handleDocumentHandler(configSettings);
|
|
297
271
|
await this.logWarnings(configSettings);
|
|
298
272
|
this.cli.writeSuccess("\nConfig generation completed 👏\n");
|
|
299
273
|
}
|
|
@@ -172,7 +172,7 @@ const config = {
|
|
|
172
172
|
{{/unless}}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
const documentHandler = new DocumentHandler({
|
|
175
|
+
const documentHandler = new {{#if addPreRendering}}DomDocumentHandler{{else}}DocumentHandler{{/if}}({
|
|
176
176
|
...config,
|
|
177
177
|
app: APP,
|
|
178
178
|
dynamicFetcher: DYNAMIC_FETCHER,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BundleService } from "../bundler";
|
|
2
2
|
import { CliService } from "../cli";
|
|
3
3
|
import { CustomerConfig, FileListInterface } from "../integration-api";
|
|
4
|
+
import { EntityManager } from "baqend";
|
|
4
5
|
import { DocumentHandlerResponse } from "./server/document-handler-response";
|
|
5
6
|
export declare class DocumentHandlerServer {
|
|
6
7
|
private customerConfig;
|
|
@@ -8,10 +9,11 @@ export declare class DocumentHandlerServer {
|
|
|
8
9
|
private bundler;
|
|
9
10
|
private cli;
|
|
10
11
|
private verboseLevel;
|
|
12
|
+
private entityManager?;
|
|
11
13
|
private documentHandlerCode;
|
|
12
14
|
private documentHandlerConfigCode;
|
|
13
15
|
private database;
|
|
14
|
-
constructor(customerConfig: CustomerConfig, files: FileListInterface, bundler: BundleService, cli: CliService, verboseLevel?: boolean);
|
|
16
|
+
constructor(customerConfig: CustomerConfig, files: FileListInterface, bundler: BundleService, cli: CliService, verboseLevel?: boolean, entityManager?: EntityManager);
|
|
15
17
|
transform(html: string, variation: string, url: string, headers: {
|
|
16
18
|
[name: string]: string;
|
|
17
19
|
}): Promise<DocumentHandlerResponse>;
|
|
@@ -21,15 +21,17 @@ class DocumentHandlerServer {
|
|
|
21
21
|
bundler;
|
|
22
22
|
cli;
|
|
23
23
|
verboseLevel;
|
|
24
|
+
entityManager;
|
|
24
25
|
documentHandlerCode;
|
|
25
26
|
documentHandlerConfigCode;
|
|
26
27
|
database;
|
|
27
|
-
constructor(customerConfig, files, bundler, cli, verboseLevel = false) {
|
|
28
|
+
constructor(customerConfig, files, bundler, cli, verboseLevel = false, entityManager) {
|
|
28
29
|
this.customerConfig = customerConfig;
|
|
29
30
|
this.files = files;
|
|
30
31
|
this.bundler = bundler;
|
|
31
32
|
this.cli = cli;
|
|
32
33
|
this.verboseLevel = verboseLevel;
|
|
34
|
+
this.entityManager = entityManager;
|
|
33
35
|
}
|
|
34
36
|
async transform(html, variation, url, headers) {
|
|
35
37
|
if (!this.documentHandlerCode) {
|
|
@@ -160,6 +162,9 @@ class DocumentHandlerServer {
|
|
|
160
162
|
const vmContext = { console: vmConsole, module: { exports: {} } };
|
|
161
163
|
vm.runInNewContext(databaseCode, vmContext);
|
|
162
164
|
this.database = vmContext.module.exports;
|
|
165
|
+
if (this.entityManager) {
|
|
166
|
+
this.database.token = this.entityManager.token;
|
|
167
|
+
}
|
|
163
168
|
}
|
|
164
169
|
return this.database;
|
|
165
170
|
}
|
package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js
CHANGED
|
@@ -8,6 +8,8 @@ const cli_1 = require("../../cli");
|
|
|
8
8
|
const required_file_not_found_error_1 = tslib_1.__importDefault(require("../error/required-file-not-found-error"));
|
|
9
9
|
const document_handler_server_1 = require("../document-handler-server");
|
|
10
10
|
const bundler_1 = require("../../bundler");
|
|
11
|
+
const entity_manager_factory_1 = require("../../config-api/entity-manager-factory");
|
|
12
|
+
const safe_1 = require("../../../helpers/safe");
|
|
11
13
|
class DocumentHandlerRuntimeServiceFactory {
|
|
12
14
|
context;
|
|
13
15
|
cliConfig;
|
|
@@ -35,7 +37,8 @@ class DocumentHandlerRuntimeServiceFactory {
|
|
|
35
37
|
const customerConfig = this.getCustomerConfig(files);
|
|
36
38
|
const bundler = new bundler_1.BundleServiceFactory().buildService();
|
|
37
39
|
const cliService = new cli_1.CliServiceFactory().getService();
|
|
38
|
-
|
|
40
|
+
const entityManagerResult = await (0, safe_1.safe)(new entity_manager_factory_1.EntityManagerFactory().getEntityManager(customerConfig.app));
|
|
41
|
+
return new document_handler_server_1.DocumentHandlerServer(customerConfig, files, bundler, cliService, this.context.verboseLevel, entityManagerResult.success ? entityManagerResult.data : null);
|
|
39
42
|
}
|
|
40
43
|
prepareIntegrationApi() {
|
|
41
44
|
const integrationApiContext = new integration_api_1.IntegrationApiContext(this.context.customerPath, this.context.configName, this.context.fileDependencies, [".git", ".idea", "node_modules"]);
|
|
@@ -33,7 +33,7 @@ class CustomerConfig {
|
|
|
33
33
|
static createFrom(configFile, configName) {
|
|
34
34
|
const { app, origins, domain, swPath, scope, appDomain, installPath, installParams, name, forceInstall, chromeFlags, dependencies, } = configFile;
|
|
35
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
|
-
`https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall ||
|
|
36
|
+
`https://${app}.app.baqend.com/v1/speedkit/install.js?d=${name || configName}`, installParams || 'async="" crossorigin="anonymous"', name, forceInstall || false, chromeFlags, dependencies || {});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.CustomerConfig = CustomerConfig;
|
package/oclif.manifest.json
CHANGED