@speedkit/cli 3.0.0 → 3.1.1
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,18 @@
|
|
|
1
|
+
## [3.1.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.1.0...v3.1.1) (2025-08-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **onboarding:** resolvepath correctly ([1249efb](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/1249efb427b1b879f2fcde3b5155209530052000))
|
|
7
|
+
* **onboarding:** set correctPath for all useCases ([e445d29](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/e445d29415c9e6ff63ecfb5be0b137e6f9cac903))
|
|
8
|
+
|
|
9
|
+
# [3.1.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.0.0...v3.1.0) (2025-08-08)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **onboarding:** recreate extensionCompatibility with chrome > 37 ([29af4eb](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/29af4eb10c42a12ed02c21dfb85169c3fc68b05d))
|
|
15
|
+
|
|
1
16
|
# [3.0.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.95.0...v3.0.0) (2025-08-08)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@ import { Protocol } from "puppeteer-core";
|
|
|
3
3
|
import { UserCliConfig } from "../../helpers/cli-config";
|
|
4
4
|
import { AbortResponse } from "./browser/abort-response";
|
|
5
5
|
import { FlagInput } from "@oclif/core/lib/interfaces/parser";
|
|
6
|
+
import { VanillaPuppeteer } from "puppeteer-extra";
|
|
6
7
|
export declare const BROWSER_EVENTS: {
|
|
7
8
|
DISCONNECTED: string;
|
|
8
9
|
FETCH_AUTH_REQUIRED: string;
|
|
@@ -36,7 +37,12 @@ export declare class BrowserContext {
|
|
|
36
37
|
userAgent?: string;
|
|
37
38
|
readonly browserArgs: string[];
|
|
38
39
|
readonly chromePath: string;
|
|
40
|
+
readonly browserDetails: string;
|
|
39
41
|
constructor(domain: string, chromeFlags?: string[], userConfig?: UserCliConfig, userAgent?: string);
|
|
42
|
+
private checkBrowserDetails;
|
|
43
|
+
private isChromeBrowser;
|
|
44
|
+
private getBrowserExtensionPath;
|
|
45
|
+
getPuppeteerLaunchOptions(): Parameters<VanillaPuppeteer["launch"]>[0];
|
|
40
46
|
}
|
|
41
47
|
export interface FetchRequestPausedEventHandler {
|
|
42
48
|
handle(event: Protocol.Fetch.RequestPausedEvent, client: CDPSession): Promise<AbortResponse | Partial<Protocol.Fetch.FulfillRequestRequest> | void>;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SpeedKitInstallRegex = exports.USER_AGENT = exports.OnboardingContext = exports.BrowserContext = exports.CDP_SESSION = exports.BROWSER_EVENTS = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
5
6
|
const cli_parameters_1 = require("../../models/cli-parameters");
|
|
6
7
|
const browser_config_1 = require("./browser/config/browser-config");
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
|
+
const safe_1 = require("../../helpers/safe");
|
|
10
|
+
const application_error_1 = tslib_1.__importDefault(require("../error-handling/error/application-error"));
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
7
13
|
const DEFAULT_BROWSER_ARGS = [
|
|
8
14
|
"--enable-features=Translate,NetworkService",
|
|
9
15
|
"--no-first-run",
|
|
10
16
|
"--no-default-browser-check",
|
|
11
17
|
"--disable-infobars",
|
|
18
|
+
// "--enable-automation",
|
|
12
19
|
];
|
|
13
20
|
exports.BROWSER_EVENTS = {
|
|
14
21
|
DISCONNECTED: "disconnected",
|
|
@@ -43,6 +50,7 @@ class BrowserContext {
|
|
|
43
50
|
userAgent;
|
|
44
51
|
browserArgs;
|
|
45
52
|
chromePath;
|
|
53
|
+
browserDetails;
|
|
46
54
|
constructor(domain, chromeFlags, userConfig, userAgent) {
|
|
47
55
|
this.domain = domain;
|
|
48
56
|
this.chromeFlags = chromeFlags;
|
|
@@ -50,11 +58,9 @@ class BrowserContext {
|
|
|
50
58
|
this.userAgent = userAgent;
|
|
51
59
|
this.domain = domain;
|
|
52
60
|
this.chromeFlags = chromeFlags || [];
|
|
53
|
-
this.chromePath = userConfig.chromePath;
|
|
61
|
+
this.chromePath = (0, node_path_1.resolve)(userConfig.chromePath);
|
|
54
62
|
const browserArguments = DEFAULT_BROWSER_ARGS;
|
|
55
|
-
|
|
56
|
-
browserArguments.push(`--load-extension=${userConfig?.chromeExtensionPaths}`, `--disable-extensions-except=${userConfig?.chromeExtensionPaths}`);
|
|
57
|
-
}
|
|
63
|
+
this.browserDetails = this.checkBrowserDetails(this.chromePath);
|
|
58
64
|
if (userConfig?.chromeUserProfilePath) {
|
|
59
65
|
browserArguments.push(`--user-data-dir=${userConfig?.chromeUserProfilePath}`);
|
|
60
66
|
}
|
|
@@ -69,6 +75,55 @@ class BrowserContext {
|
|
|
69
75
|
...this.chromeFlags,
|
|
70
76
|
];
|
|
71
77
|
}
|
|
78
|
+
checkBrowserDetails(browserExecutablePath) {
|
|
79
|
+
if (!(0, node_fs_1.existsSync)(browserExecutablePath)) {
|
|
80
|
+
throw new application_error_1.default(`No executable found in ${browserExecutablePath}`, [
|
|
81
|
+
"Check your configured browserExecutablePath",
|
|
82
|
+
"in envVar CHROME_PATH",
|
|
83
|
+
"or ~/.config/speed-kit-cli/config.json {chromePath:}",
|
|
84
|
+
]);
|
|
85
|
+
}
|
|
86
|
+
const result = (0, safe_1.safe)(() => {
|
|
87
|
+
return (0, node_child_process_1.execSync)(`${browserExecutablePath} --version`).toString();
|
|
88
|
+
});
|
|
89
|
+
if (result.success === false) {
|
|
90
|
+
throw new application_error_1.default(result.error, [
|
|
91
|
+
"Check your configured browserExecutablePath",
|
|
92
|
+
`No executable found in ${browserExecutablePath}`,
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
return result.data.trim().replaceAll("\n", "");
|
|
96
|
+
}
|
|
97
|
+
isChromeBrowser() {
|
|
98
|
+
return (!!/chrome/i.test(this.browserDetails) &&
|
|
99
|
+
!!/google/i.test(this.browserDetails));
|
|
100
|
+
}
|
|
101
|
+
getBrowserExtensionPath() {
|
|
102
|
+
if (this.userConfig?.chromeExtensionPaths) {
|
|
103
|
+
return this.userConfig.chromeExtensionPaths.split(",");
|
|
104
|
+
}
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
getPuppeteerLaunchOptions() {
|
|
108
|
+
const options = {
|
|
109
|
+
devtools: true,
|
|
110
|
+
timeout: 0,
|
|
111
|
+
defaultViewport: null,
|
|
112
|
+
headless: false /* ignoreDefaultArgs: true, */,
|
|
113
|
+
executablePath: this.chromePath,
|
|
114
|
+
args: this.browserArgs,
|
|
115
|
+
};
|
|
116
|
+
if (this.userConfig?.chromeExtensionPaths) {
|
|
117
|
+
if (this.isChromeBrowser()) {
|
|
118
|
+
options["pipe"] = true;
|
|
119
|
+
options["enableExtensions"] = this.getBrowserExtensionPath();
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
options.args.push(`--load-extension=${this.userConfig?.chromeExtensionPaths}`, `--disable-extensions-except=${this.userConfig?.chromeExtensionPaths}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return options;
|
|
126
|
+
}
|
|
72
127
|
}
|
|
73
128
|
exports.BrowserContext = BrowserContext;
|
|
74
129
|
class OnboardingContext {
|
|
@@ -29,21 +29,14 @@ class OnboardingService {
|
|
|
29
29
|
* prepare puppeteerBrowser, add eventListeners and start
|
|
30
30
|
*/
|
|
31
31
|
async run() {
|
|
32
|
-
this.cli.startAction(
|
|
32
|
+
this.cli.startAction(`prepare browser ${this.cli.style.bold(this.browserContext.browserDetails)}`);
|
|
33
33
|
const browser = await this.prepareBrowser();
|
|
34
34
|
const page = await this.preparePage(browser);
|
|
35
35
|
this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
|
|
36
36
|
await this.navigate(page, `${this.customerConfig.scope}speed-kit-install.html?url=${this.customerConfig.scope}`);
|
|
37
37
|
}
|
|
38
38
|
async prepareBrowser() {
|
|
39
|
-
const browser = await puppeteer_extra_1.default.launch(
|
|
40
|
-
devtools: true,
|
|
41
|
-
timeout: 0,
|
|
42
|
-
defaultViewport: null,
|
|
43
|
-
headless: false /* ignoreDefaultArgs: true, */,
|
|
44
|
-
executablePath: this.browserContext.chromePath,
|
|
45
|
-
args: this.browserContext.browserArgs,
|
|
46
|
-
});
|
|
39
|
+
const browser = await puppeteer_extra_1.default.launch(this.browserContext.getPuppeteerLaunchOptions());
|
|
47
40
|
for (const target of browser.targets()) {
|
|
48
41
|
if (target.type() === "browser") {
|
|
49
42
|
await this.fetchEventHandler.handleRequestFetchEvents(target);
|
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": "3.
|
|
4
|
+
"version": "3.1.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Baqend.com",
|
|
7
7
|
"email": "info@baqend.com"
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"node-fetch": "^2.7.0",
|
|
92
92
|
"parse5": "7.1",
|
|
93
93
|
"parse5-htmlparser2-tree-adapter": "7.0.0",
|
|
94
|
-
"puppeteer": "^
|
|
94
|
+
"puppeteer": "^24.16.0",
|
|
95
95
|
"puppeteer-extra": "^3.3.6",
|
|
96
96
|
"semver": "^7.6.3",
|
|
97
97
|
"strip-comments": "^2.0.1",
|