@speedkit/cli 2.70.1 → 2.72.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 +20 -0
- package/README.md +1 -1
- package/dist/services/customer-config/templates/config_documentHandler.js.hbs +22 -0
- package/dist/services/customer-config/templates/config_dynamicBlocks.es6.hbs +0 -14
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +12 -0
- package/dist/services/onboarding/browser/extension/extension-downloader.js +89 -0
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +4 -2
- package/dist/services/onboarding/browser/extension/extension-validator.js +21 -6
- package/dist/services/onboarding/onboarding-service-factory.js +3 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
# [2.72.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.71.0...v2.72.0) (2024-12-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **integration-devtools:** only update if installed ([d9f9710](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d9f971019d0baaa05dbba4e2ca684419577e5a78))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **onboarding:** embed integration-devtools ([530d863](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/530d8633c06a84110f24116885c4f02ee1d9df65))
|
|
12
|
+
|
|
13
|
+
# [2.71.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.70.1...v2.71.0) (2024-12-12)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **wizard:** lambda add initial hiding of shadow-dom and un-hide when rendered ([dddfd62](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/dddfd62791754558ae7481914c1be3eef65ffc8f))
|
|
19
|
+
* **wizard:** remove legacy dynamic blocks lambda server-side rendering related code ([3ee1e4a](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/3ee1e4a755b21b28f56aa4f2e74f910e093be6ba))
|
|
20
|
+
|
|
1
21
|
## [2.70.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.70.0...v2.70.1) (2024-12-12)
|
|
2
22
|
|
|
3
23
|
|
package/README.md
CHANGED
|
@@ -98,6 +98,8 @@ const config = {
|
|
|
98
98
|
assignStylesToShadowDom(document);
|
|
99
99
|
addDeclarativeShadowDOMPolyfill(document);
|
|
100
100
|
addPolyFillAfterMainPreRenderTemplate(document);
|
|
101
|
+
hideCustomShadowDom(document);
|
|
102
|
+
showCustomShadowDom(document);
|
|
101
103
|
{{/unless}}
|
|
102
104
|
{{#if supportShadowDomInPreRendering}}
|
|
103
105
|
overrideCustomElementDefine(document);
|
|
@@ -350,6 +352,26 @@ export const post = async (db, req, res) => {
|
|
|
350
352
|
topTemplate.after(polyfillScript);
|
|
351
353
|
});
|
|
352
354
|
}
|
|
355
|
+
|
|
356
|
+
function hideCustomShadowDom(document) {
|
|
357
|
+
const customShadowRoots = getCustomShadowElements(document);
|
|
358
|
+
|
|
359
|
+
customShadowRoots.forEach((element) => {
|
|
360
|
+
const style = document.createElement("style");
|
|
361
|
+
style.textContent = `.speed-kit-pre-rendered-block-added{visibility:hidden;}`;
|
|
362
|
+
element.prepend(style);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function showCustomShadowDom(document) {
|
|
367
|
+
const customShadowRoots = getCustomShadowElements(document);
|
|
368
|
+
|
|
369
|
+
customShadowRoots.forEach((element) => {
|
|
370
|
+
const style = document.createElement("style");
|
|
371
|
+
style.textContent = `.speed-kit-pre-rendered-block-added{visibility:visible;}`;
|
|
372
|
+
element.appendChild(style);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
353
375
|
{{#if supportShadowDomInPreRendering}}
|
|
354
376
|
//================================================================================
|
|
355
377
|
// PuppeteerCallback
|
|
@@ -13,20 +13,6 @@
|
|
|
13
13
|
{{/if}}
|
|
14
14
|
|
|
15
15
|
blocks: [
|
|
16
|
-
{{#if addPreRendering}}
|
|
17
|
-
{{#unless supportShadowDomInPreRendering}}
|
|
18
|
-
...preRenderedRootConfig.map((config) => {
|
|
19
|
-
return {
|
|
20
|
-
selector: config.selector,
|
|
21
|
-
merge: (localBlock, remoteBlock) => {
|
|
22
|
-
handlePreRenderBlock(localBlock, remoteBlock);
|
|
23
|
-
},
|
|
24
|
-
detectChanges: false,
|
|
25
|
-
};
|
|
26
|
-
}),
|
|
27
|
-
|
|
28
|
-
{{/unless}}
|
|
29
|
-
{{/if}}
|
|
30
16
|
// TODO: adjust/replace this exemplary list
|
|
31
17
|
{
|
|
32
18
|
{{#if addPreRendering}}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UserCliConfig } from "../../../../helpers/cli-config";
|
|
2
|
+
import { CliServiceInterface } from "../../../cli";
|
|
3
|
+
export declare class ExtensionDownloader {
|
|
4
|
+
private userConfig;
|
|
5
|
+
private cli;
|
|
6
|
+
constructor(userConfig: UserCliConfig, cli: CliServiceInterface);
|
|
7
|
+
downloadExtension(): Promise<string | false>;
|
|
8
|
+
private updateLocalDevtools;
|
|
9
|
+
isInstalled(): boolean;
|
|
10
|
+
private checkInstalledVersion;
|
|
11
|
+
private getRemoteVersion;
|
|
12
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtensionDownloader = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
6
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
7
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
8
|
+
const extract_zip_1 = tslib_1.__importDefault(require("extract-zip"));
|
|
9
|
+
const cli_1 = require("../../../cli");
|
|
10
|
+
const safe_1 = require("../../../../helpers/safe");
|
|
11
|
+
const devtools = "integration-devtools";
|
|
12
|
+
class ExtensionDownloader {
|
|
13
|
+
userConfig;
|
|
14
|
+
cli;
|
|
15
|
+
constructor(userConfig, cli) {
|
|
16
|
+
this.userConfig = userConfig;
|
|
17
|
+
this.cli = cli;
|
|
18
|
+
}
|
|
19
|
+
async downloadExtension() {
|
|
20
|
+
// check for already installed devExtension
|
|
21
|
+
const isInstalled = this.isInstalled();
|
|
22
|
+
if (isInstalled) {
|
|
23
|
+
// check for updates
|
|
24
|
+
const remoteVersion = await this.getRemoteVersion();
|
|
25
|
+
const localVersion = await this.checkInstalledVersion();
|
|
26
|
+
if (semver_1.default.compare(remoteVersion, localVersion) > 0) {
|
|
27
|
+
const response = await this.cli.confirm(`integration-devtools update available from ${localVersion} to ${remoteVersion} Install?`, true);
|
|
28
|
+
if (!response) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
const response = await this.cli.confirm("Do you want to install devtools-extension?", true);
|
|
35
|
+
if (!response) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
this.cli.startAction("update integration-devtools");
|
|
40
|
+
const response = await (0, safe_1.safe)(this.updateLocalDevtools());
|
|
41
|
+
if (response.success === false) {
|
|
42
|
+
this.cli.endAction(cli_1.CliActionStatus.FAILED);
|
|
43
|
+
this.cli.writeError(response.error);
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
47
|
+
return response.data;
|
|
48
|
+
}
|
|
49
|
+
async updateLocalDevtools() {
|
|
50
|
+
// downloadExtension
|
|
51
|
+
const extensionResponse = await fetch("https://threepointonefour.app.baqend.com/v1/code/webhook_gitlab_release?download");
|
|
52
|
+
// get fileName from header
|
|
53
|
+
const fileName = extensionResponse.headers.get("filename");
|
|
54
|
+
// resolve path for unpacked extension
|
|
55
|
+
const extensionUnpacked = node_path_1.default.resolve(this.userConfig.tempFolder, devtools);
|
|
56
|
+
// resolve path for zipFile
|
|
57
|
+
const archivePath = node_path_1.default.resolve(this.userConfig.tempFolder, fileName);
|
|
58
|
+
// getFileBlob
|
|
59
|
+
const extensionBlob = await extensionResponse.arrayBuffer();
|
|
60
|
+
// write zipFile
|
|
61
|
+
node_fs_1.default.writeFileSync(archivePath, Buffer.from(extensionBlob));
|
|
62
|
+
// cleanUp older versions
|
|
63
|
+
node_fs_1.default.rmSync(extensionUnpacked, { recursive: true, force: true });
|
|
64
|
+
// extract zipArchive
|
|
65
|
+
await (0, extract_zip_1.default)(archivePath, { dir: extensionUnpacked });
|
|
66
|
+
// remove zipArchive
|
|
67
|
+
node_fs_1.default.rmSync(archivePath);
|
|
68
|
+
return extensionUnpacked;
|
|
69
|
+
}
|
|
70
|
+
isInstalled() {
|
|
71
|
+
const extensionPath = node_path_1.default.resolve(this.userConfig.tempFolder, devtools, "manifest.json");
|
|
72
|
+
return node_fs_1.default.existsSync(extensionPath);
|
|
73
|
+
}
|
|
74
|
+
checkInstalledVersion() {
|
|
75
|
+
const extensionPath = node_path_1.default.resolve(this.userConfig.tempFolder, devtools, "manifest.json");
|
|
76
|
+
const manifestFile = node_fs_1.default.readFileSync(extensionPath, "utf-8");
|
|
77
|
+
const manifestConfig = JSON.parse(manifestFile);
|
|
78
|
+
return manifestConfig.version;
|
|
79
|
+
}
|
|
80
|
+
async getRemoteVersion() {
|
|
81
|
+
const versionResponse = await fetch("https://threepointonefour.app.baqend.com/v1/code/webhook_gitlab_release");
|
|
82
|
+
if (!versionResponse.ok) {
|
|
83
|
+
throw new Error("Could not find version for" + devtools);
|
|
84
|
+
}
|
|
85
|
+
const response = await versionResponse.json();
|
|
86
|
+
return response.version;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.ExtensionDownloader = ExtensionDownloader;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { UserCliConfig } from "../../../../helpers/cli-config";
|
|
2
2
|
import { CliServiceInterface } from "../../../cli";
|
|
3
|
+
import { ExtensionDownloader } from "./extension-downloader";
|
|
3
4
|
export declare class ExtensionValidator {
|
|
5
|
+
private extensionDownloader;
|
|
4
6
|
private cliConfig;
|
|
5
|
-
private cliBasePath;
|
|
6
7
|
private cli;
|
|
7
|
-
constructor(
|
|
8
|
+
constructor(extensionDownloader: ExtensionDownloader, cliConfig: UserCliConfig, cli: CliServiceInterface);
|
|
8
9
|
getValidBrowserExtensionPaths(): Promise<string[]>;
|
|
9
10
|
private getManifestConfig;
|
|
11
|
+
private handleDevtoolsExtension;
|
|
10
12
|
}
|
|
@@ -9,17 +9,16 @@ const safe_1 = require("../../../../helpers/safe");
|
|
|
9
9
|
const node_fs_1 = require("node:fs");
|
|
10
10
|
const browser_extension_error_1 = require("../../error/browser-extension-error");
|
|
11
11
|
class ExtensionValidator {
|
|
12
|
+
extensionDownloader;
|
|
12
13
|
cliConfig;
|
|
13
|
-
cliBasePath;
|
|
14
14
|
cli;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(extensionDownloader, cliConfig, cli) {
|
|
16
|
+
this.extensionDownloader = extensionDownloader;
|
|
16
17
|
this.cliConfig = cliConfig;
|
|
17
|
-
this.cliBasePath = cliBasePath;
|
|
18
18
|
this.cli = cli;
|
|
19
19
|
}
|
|
20
20
|
async getValidBrowserExtensionPaths() {
|
|
21
21
|
const validExtensions = [];
|
|
22
|
-
const validPaths = [];
|
|
23
22
|
this.cli.startAction("resolve browserExtensions");
|
|
24
23
|
const browserExtensions = this.cliConfig.chromeExtensionPaths
|
|
25
24
|
.split(",")
|
|
@@ -37,13 +36,14 @@ class ExtensionValidator {
|
|
|
37
36
|
name: manifestConfig.name,
|
|
38
37
|
version: manifestConfig.version,
|
|
39
38
|
});
|
|
40
|
-
validPaths.push(cleanedExtensionPath);
|
|
41
39
|
}
|
|
42
40
|
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
41
|
+
this.cli.spacer();
|
|
42
|
+
await this.handleDevtoolsExtension(validExtensions);
|
|
43
43
|
if (validExtensions.length > 0) {
|
|
44
44
|
this.cli.table(validExtensions, { name: {}, version: {}, path: {} });
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return validExtensions.map((config) => config.path);
|
|
47
47
|
}
|
|
48
48
|
async getManifestConfig(cleanedExtensionPath) {
|
|
49
49
|
const manifestPath = node_path_1.default.resolve(cleanedExtensionPath, "manifest.json");
|
|
@@ -59,5 +59,20 @@ class ExtensionValidator {
|
|
|
59
59
|
}
|
|
60
60
|
return result.data;
|
|
61
61
|
}
|
|
62
|
+
async handleDevtoolsExtension(validExtensions) {
|
|
63
|
+
if (validExtensions.some((config) => config.name.toLowerCase().includes("devtools extension"))) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const path = await this.extensionDownloader.downloadExtension();
|
|
67
|
+
if (path === false) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const extensionConfig = await this.getManifestConfig(path);
|
|
71
|
+
validExtensions.push({
|
|
72
|
+
path: path,
|
|
73
|
+
name: extensionConfig.name,
|
|
74
|
+
version: extensionConfig.version,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
62
77
|
}
|
|
63
78
|
exports.ExtensionValidator = ExtensionValidator;
|
|
@@ -41,6 +41,7 @@ const fs = tslib_1.__importStar(require("node:fs"));
|
|
|
41
41
|
const path = tslib_1.__importStar(require("node:path"));
|
|
42
42
|
const static_recipe_1 = require("../integration-api/virtual/static-recipe");
|
|
43
43
|
const diff_against_current_page_1 = require("./dashboard/diff-against-current-page");
|
|
44
|
+
const extension_downloader_1 = require("./browser/extension/extension-downloader");
|
|
44
45
|
class OnboardingServiceFactory {
|
|
45
46
|
context;
|
|
46
47
|
cliConfig;
|
|
@@ -66,7 +67,8 @@ class OnboardingServiceFactory {
|
|
|
66
67
|
const skTemplate = new install_speed_kit_js_template_1.InstallSpeedKitJsTemplate();
|
|
67
68
|
const speedKitInstallContext = new speed_kit_install_context_1.SpeedKitInstallContext(customerConfig, this.context.configName, files, bundler, skTemplate, this.context.local);
|
|
68
69
|
await this.buildInstallResource(speedKitInstallContext, files, cli);
|
|
69
|
-
const
|
|
70
|
+
const extensionDownloader = new extension_downloader_1.ExtensionDownloader(this.cliConfig, cli);
|
|
71
|
+
const extensionPaths = await new extension_validator_1.ExtensionValidator(extensionDownloader, this.cliConfig, cli).getValidBrowserExtensionPaths();
|
|
70
72
|
this.cliConfig.chromeExtensionPaths = extensionPaths.join(",");
|
|
71
73
|
const browserContext = new onboarding_model_1.BrowserContext(domainToStart, customerConfig.chromeFlags || [], this.cliConfig);
|
|
72
74
|
const fileWatcher = new file_watcher_1.FileWatcher(cli, customerConfig, files, documentHandler, browserContext, cache);
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speedkit/cli",
|
|
3
3
|
"description": "Speed Kit CLI",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.72.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Baqend.com",
|
|
7
7
|
"email": "info@baqend.com"
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"parse5-htmlparser2-tree-adapter": "7.0.0",
|
|
93
93
|
"puppeteer": "^22.6.5",
|
|
94
94
|
"puppeteer-extra": "^3.3.6",
|
|
95
|
+
"semver": "^7.6.3",
|
|
95
96
|
"strip-comments": "^2.0.1",
|
|
96
97
|
"uuid": "^9.0.1",
|
|
97
98
|
"esbuild": "^0.20.2",
|