@speedkit/cli 3.4.1 → 3.4.3

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,17 @@
1
+ ## [3.4.3](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.4.2...v3.4.3) (2025-08-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * double escape of commands ([ec827a8](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/ec827a8b15008fbd4b04e00d7f29deb68f1cae80))
7
+
8
+ ## [3.4.2](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.4.1...v3.4.2) (2025-08-19)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **onboarding:** set universal fix for whiteSpacePaths for chromeExecutable ([fa3c743](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/fa3c7433161b4d1f0a184e31afe1d74b17f535b5))
14
+
1
15
  ## [3.4.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.4.0...v3.4.1) (2025-08-19)
2
16
 
3
17
 
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/3.4.1 linux-x64 node-v20.19.4
24
+ @speedkit/cli/3.4.3 linux-x64 node-v20.19.4
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -35,4 +35,5 @@ export interface CliServiceInterface {
35
35
  writeError(message: string, buffered?: boolean): void;
36
36
  writeSuccess(message: string, buffered?: boolean): void;
37
37
  writeWarning(message: string, buffered?: boolean): void;
38
+ execSync(command: string, arguments_: string[]): string;
38
39
  }
@@ -30,5 +30,6 @@ export declare class CliService implements CliServiceInterface {
30
30
  writeError(message: string, buffered?: boolean): void;
31
31
  writeSuccess(message: string, buffered?: boolean): void;
32
32
  writeWarning(message: string, buffered?: boolean): void;
33
+ execSync(command: string, arguments_?: string[]): string;
33
34
  private getFormattedMessage;
34
35
  }
@@ -6,6 +6,9 @@ const prompts_1 = require("@inquirer/prompts");
6
6
  const chalk_1 = tslib_1.__importDefault(require("chalk")); // interactive prompts
7
7
  const core_1 = require("@oclif/core");
8
8
  const cli_service_model_1 = require("./cli-service-model");
9
+ const safe_1 = require("../../helpers/safe");
10
+ const node_child_process_1 = require("node:child_process");
11
+ const application_error_1 = tslib_1.__importDefault(require("../error-handling/error/application-error"));
9
12
  class CliService {
10
13
  quiet;
11
14
  style = chalk_1.default;
@@ -158,6 +161,18 @@ class CliService {
158
161
  }
159
162
  this.write(this.style.yellow(message));
160
163
  }
164
+ execSync(command, arguments_) {
165
+ const result = (0, safe_1.safe)(() => {
166
+ return (0, node_child_process_1.execSync)(`${command} ${arguments_.join(" ")}`).toString();
167
+ });
168
+ if (result.success !== true) {
169
+ throw new application_error_1.default(result.error, [
170
+ `running ${command}`,
171
+ `with arguments ${arguments_.join(" ")}`,
172
+ ]);
173
+ }
174
+ return result.data;
175
+ }
161
176
  getFormattedMessage(questionText) {
162
177
  return `${this.style.bold(questionText)}`;
163
178
  }
@@ -36,10 +36,6 @@ class CustomerConfigHandler extends file_handler_1.default {
36
36
  return new customer_config_file_1.CustomerConfigFile(this.getFileName(filePath), filePath, fileContent, config, this.configName, this.testApp);
37
37
  }
38
38
  async loadConfig(fileContent, filePath) {
39
- if ((fileContent.includes("process.env.TEST_APP") && this.testApp === null) ||
40
- this.testApp.length === 0) {
41
- throw new application_error_1.default("please specify env TEST_APP in your .env or configFile file");
42
- }
43
39
  const configsResult = (0, safe_1.safe)(() => {
44
40
  return JSON.parse(fileContent);
45
41
  });
@@ -4,9 +4,9 @@ export declare class ExecutableValidator {
4
4
  readonly userConfig: UserCliConfig;
5
5
  private cli;
6
6
  constructor(userConfig: UserCliConfig, cli: CliServiceInterface);
7
- validateOrInstall(): Promise<void>;
7
+ validateOrInstall(): Promise<string>;
8
+ private getCurrentBrowserVersion;
8
9
  private getExecutablePathFromPuppeteer;
9
10
  private isValidBrowserExecutable;
10
- private cleanPath;
11
11
  installBrowser(): Promise<void>;
12
12
  }
@@ -19,9 +19,8 @@ class ExecutableValidator {
19
19
  async validateOrInstall() {
20
20
  // check if a valid browserExecutablePath is configured
21
21
  const userChromePath = this.userConfig?.chromePath;
22
- if (userChromePath.length > 0 &&
23
- this.isValidBrowserExecutable(userChromePath)) {
24
- return;
22
+ if (this.isValidBrowserExecutable()) {
23
+ return this.getCurrentBrowserVersion();
25
24
  }
26
25
  // write error if configured path is not executable
27
26
  if (userChromePath.length > 0) {
@@ -33,7 +32,7 @@ class ExecutableValidator {
33
32
  if (installedBrowsers.length > 0) {
34
33
  // found an installed browser, set path to this
35
34
  this.userConfig.chromePath = installedBrowsers[0].executablePath;
36
- return;
35
+ return this.getCurrentBrowserVersion();
37
36
  }
38
37
  // write warning that no browser is configured
39
38
  if (userChromePath.length === 0) {
@@ -53,17 +52,19 @@ class ExecutableValidator {
53
52
  await this.installBrowser();
54
53
  // set path to freshly installed chrome
55
54
  this.userConfig.chromePath = this.getExecutablePathFromPuppeteer();
55
+ return this.getCurrentBrowserVersion();
56
+ }
57
+ getCurrentBrowserVersion() {
58
+ return this.cli.execSync(`"${this.userConfig.chromePath}"`, ["--version"]);
56
59
  }
57
60
  getExecutablePathFromPuppeteer() {
58
61
  const puppeteerCache = new browsers_2.Cache(this.userConfig.tempFolder);
59
62
  const installedBrowsers = puppeteerCache.getInstalledBrowsers();
60
63
  return installedBrowsers[0].executablePath;
61
64
  }
62
- isValidBrowserExecutable(chromePath) {
63
- return (0, node_fs_1.existsSync)(this.cleanPath((0, node_path_1.resolve)(chromePath)));
64
- }
65
- cleanPath(path) {
66
- return path.trim().replaceAll(" ", "\\ ");
65
+ isValidBrowserExecutable() {
66
+ return (this.userConfig?.chromePath.length > 0 &&
67
+ (0, node_fs_1.existsSync)((0, node_path_1.resolve)(this.userConfig?.chromePath.trim())));
67
68
  }
68
69
  async installBrowser() {
69
70
  const puppeteerCli = new browsers_1.CLI({
@@ -32,15 +32,13 @@ export declare const CDP_SESSION: {
32
32
  };
33
33
  export declare class BrowserContext {
34
34
  readonly domain: string;
35
+ readonly browserVersionString: string;
35
36
  readonly chromeFlags?: string[];
36
37
  readonly userConfig?: UserCliConfig;
37
38
  userAgent?: string;
38
39
  readonly browserArgs: string[];
39
40
  readonly chromePath: string;
40
- readonly browserDetails: string;
41
- constructor(domain: string, chromeFlags?: string[], userConfig?: UserCliConfig, userAgent?: string);
42
- private cleanPath;
43
- private checkBrowserDetails;
41
+ constructor(domain: string, browserVersionString: string, chromeFlags?: string[], userConfig?: UserCliConfig, userAgent?: string);
44
42
  private isChromeBrowser;
45
43
  private getBrowserExtensionPath;
46
44
  getPuppeteerLaunchOptions(): Parameters<VanillaPuppeteer["launch"]>[0];
@@ -1,14 +1,9 @@
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");
5
4
  const core_1 = require("@oclif/core");
6
5
  const cli_parameters_1 = require("../../models/cli-parameters");
7
6
  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
7
  const node_path_1 = require("node:path");
13
8
  const DEFAULT_BROWSER_ARGS = [
14
9
  "--enable-features=Translate,NetworkService",
@@ -45,14 +40,15 @@ exports.CDP_SESSION = {
45
40
  };
46
41
  class BrowserContext {
47
42
  domain;
43
+ browserVersionString;
48
44
  chromeFlags;
49
45
  userConfig;
50
46
  userAgent;
51
47
  browserArgs;
52
48
  chromePath;
53
- browserDetails;
54
- constructor(domain, chromeFlags, userConfig, userAgent) {
49
+ constructor(domain, browserVersionString, chromeFlags, userConfig, userAgent) {
55
50
  this.domain = domain;
51
+ this.browserVersionString = browserVersionString;
56
52
  this.chromeFlags = chromeFlags;
57
53
  this.userConfig = userConfig;
58
54
  this.userAgent = userAgent;
@@ -60,7 +56,6 @@ class BrowserContext {
60
56
  this.chromeFlags = chromeFlags || [];
61
57
  this.chromePath = (0, node_path_1.resolve)(userConfig.chromePath);
62
58
  const browserArguments = DEFAULT_BROWSER_ARGS;
63
- this.browserDetails = this.checkBrowserDetails(this.chromePath);
64
59
  if (userConfig?.chromeUserProfilePath) {
65
60
  browserArguments.push(`--user-data-dir=${userConfig?.chromeUserProfilePath}`);
66
61
  }
@@ -75,31 +70,8 @@ class BrowserContext {
75
70
  ...this.chromeFlags,
76
71
  ];
77
72
  }
78
- cleanPath(path) {
79
- return path.trim().replaceAll(" ", "\\ ");
80
- }
81
- checkBrowserDetails(browserExecutablePath) {
82
- if (!(0, node_fs_1.existsSync)(browserExecutablePath)) {
83
- throw new application_error_1.default(`No executable found in ${browserExecutablePath}`, [
84
- "Check your configured browserExecutablePath",
85
- "in envVar CHROME_PATH",
86
- "or ~/.config/speed-kit-cli/config.json {chromePath:}",
87
- ]);
88
- }
89
- const result = (0, safe_1.safe)(() => {
90
- return (0, node_child_process_1.execSync)(`${this.cleanPath(browserExecutablePath)} --version`).toString();
91
- });
92
- if (result.success === false) {
93
- throw new application_error_1.default(result.error, [
94
- "Check your configured browserExecutablePath",
95
- `No executable found in ${browserExecutablePath}`,
96
- ]);
97
- }
98
- return result.data.trim().replaceAll("\n", "");
99
- }
100
73
  isChromeBrowser() {
101
- return (!!/chrome/i.test(this.browserDetails) &&
102
- !!/google/i.test(this.browserDetails));
74
+ return !!/chrome/i.test(this.browserVersionString);
103
75
  }
104
76
  getBrowserExtensionPath() {
105
77
  if (this.userConfig?.chromeExtensionPaths) {
@@ -72,8 +72,8 @@ class OnboardingServiceFactory {
72
72
  const extensionPaths = await new extension_validator_1.ExtensionValidator(extensionDownloader, this.cliConfig, cli).getValidBrowserExtensionPaths();
73
73
  this.cliConfig.chromeExtensionPaths = extensionPaths.join(",");
74
74
  const browserValidator = new executable_validator_1.ExecutableValidator(this.cliConfig, cli);
75
- await browserValidator.validateOrInstall();
76
- const browserContext = new onboarding_model_1.BrowserContext(domainToStart, customerConfig.chromeFlags || [], this.cliConfig);
75
+ const browserVersionString = await browserValidator.validateOrInstall();
76
+ const browserContext = new onboarding_model_1.BrowserContext(domainToStart, browserVersionString, customerConfig.chromeFlags || [], this.cliConfig);
77
77
  const fileWatcher = new file_watcher_1.FileWatcher(cli, customerConfig, files, documentHandler, browserContext, cache);
78
78
  const athenaClient = (await this.getAthenaClient()) || null;
79
79
  const fetchHandler = await this.getFetchEventHandler(files, customerConfig, documentHandler, cache, cli, browserContext, athenaClient);
@@ -29,7 +29,7 @@ class OnboardingService {
29
29
  * prepare puppeteerBrowser, add eventListeners and start
30
30
  */
31
31
  async run() {
32
- this.cli.startAction(`prepare browser ${this.cli.style.bold(this.browserContext.browserDetails)}`);
32
+ this.cli.startAction(`prepare browser ${this.cli.style.bold(this.browserContext.browserVersionString)}`);
33
33
  const browser = await this.prepareBrowser();
34
34
  const page = await this.preparePage(browser);
35
35
  this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
@@ -732,5 +732,5 @@
732
732
  ]
733
733
  }
734
734
  },
735
- "version": "3.4.1"
735
+ "version": "3.4.3"
736
736
  }
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.1",
4
+ "version": "3.4.3",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"