@speedkit/cli 3.3.0 → 3.4.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,23 @@
1
+ ## [3.4.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.4.0...v3.4.1) (2025-08-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **wizard:** json hbs file ([1b3e1cd](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/1b3e1cd9a69cbd12120b66d46fdc35ef5ee7e991))
7
+
8
+ # [3.4.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.3.0...v3.4.0) (2025-08-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * escape path to browserExecutable for validator ([aafcecf](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/aafcecf3433a053aa87229492b4c8aca6b28867f))
14
+
15
+
16
+ ### Features
17
+
18
+ * **onboarding:** ask to download chrome ([c2e8f01](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/c2e8f0140bae117be04cb9da580318306aa0c285))
19
+ * **onboarding:** set correctPath to validate executable exists ([3d6a4dd](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/3d6a4dd68089937866c49ed60bdaece49e63083b))
20
+
1
21
  # [3.3.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.2.0...v3.3.0) (2025-08-14)
2
22
 
3
23
 
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.3.0 linux-x64 node-v20.19.4
24
+ @speedkit/cli/3.4.1 linux-x64 node-v20.19.4
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -9,6 +9,7 @@ export type UserCliConfig = {
9
9
  slackToken: string;
10
10
  testApp: string;
11
11
  tempFolder: string;
12
+ runtimeConfig: Config;
12
13
  };
13
14
  export declare class CliConfig {
14
15
  private config;
@@ -29,6 +29,7 @@ class CliConfig {
29
29
  slackToken: "",
30
30
  testApp: "",
31
31
  tempFolder: "/tmp",
32
+ runtimeConfig: {},
32
33
  };
33
34
  constructor(config) {
34
35
  this.config = config;
@@ -40,6 +41,7 @@ class CliConfig {
40
41
  this.loadConfigFromEnvironment();
41
42
  this.resolveExtensionConfigPaths();
42
43
  this.userCliConfig.tempFolder = this.config.cacheDir;
44
+ this.userCliConfig.runtimeConfig = this.config;
43
45
  return this.userCliConfig;
44
46
  }
45
47
  createEmptyConfigFile() {
@@ -14,7 +14,7 @@
14
14
  "Plentymarkets"
15
15
  {{else}}
16
16
  "TODO: enter name of system in use"
17
- {{/if}},
17
+ {{/if}}
18
18
  },
19
19
  "app": "{{appName}}",
20
20
  "domain": "{{production.host}}",
@@ -0,0 +1,12 @@
1
+ import { UserCliConfig } from "../../../../helpers/cli-config";
2
+ import { CliServiceInterface } from "../../../cli";
3
+ export declare class ExecutableValidator {
4
+ readonly userConfig: UserCliConfig;
5
+ private cli;
6
+ constructor(userConfig: UserCliConfig, cli: CliServiceInterface);
7
+ validateOrInstall(): Promise<void>;
8
+ private getExecutablePathFromPuppeteer;
9
+ private isValidBrowserExecutable;
10
+ private cleanPath;
11
+ installBrowser(): Promise<void>;
12
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExecutableValidator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ // import CLI from puppeteer to use function as sames as `npx puppeteer browsers install`
6
+ const browsers_1 = require("@puppeteer/browsers");
7
+ const version_js_1 = require("puppeteer-core/internal/generated/version.js");
8
+ const node_fs_1 = require("node:fs");
9
+ const application_error_1 = tslib_1.__importDefault(require("../../../error-handling/error/application-error"));
10
+ const browsers_2 = require("@puppeteer/browsers");
11
+ const node_path_1 = require("node:path");
12
+ class ExecutableValidator {
13
+ userConfig;
14
+ cli;
15
+ constructor(userConfig, cli) {
16
+ this.userConfig = userConfig;
17
+ this.cli = cli;
18
+ }
19
+ async validateOrInstall() {
20
+ // check if a valid browserExecutablePath is configured
21
+ const userChromePath = this.userConfig?.chromePath;
22
+ if (userChromePath.length > 0 &&
23
+ this.isValidBrowserExecutable(userChromePath)) {
24
+ return;
25
+ }
26
+ // write error if configured path is not executable
27
+ if (userChromePath.length > 0) {
28
+ this.cli.writeError(`Invalid "chromePath" configured: ${userChromePath}`);
29
+ }
30
+ // check if a browser is installed via puppeteer
31
+ const puppeteerCache = new browsers_2.Cache(this.userConfig.tempFolder);
32
+ const installedBrowsers = puppeteerCache.getInstalledBrowsers();
33
+ if (installedBrowsers.length > 0) {
34
+ // found an installed browser, set path to this
35
+ this.userConfig.chromePath = installedBrowsers[0].executablePath;
36
+ return;
37
+ }
38
+ // write warning that no browser is configured
39
+ if (userChromePath.length === 0) {
40
+ this.cli.writeWarning(`No Browser configured`);
41
+ }
42
+ // ask if you want to download stable chrome
43
+ const result = await this.cli.confirm("Do you want to download Chrome@latest via puppeteer?", true);
44
+ // @todo set more detailed error message here.
45
+ if (!result) {
46
+ throw new application_error_1.default("No Browser found to use", [
47
+ `set path to browser executable (chromePath) in ${this.userConfig.runtimeConfig.configDir}/config.json`,
48
+ `set path to browser executable (CHROME_PATH) in ./.env or as systemwide env`,
49
+ `let the ci download the latest chrome for you`,
50
+ ]);
51
+ }
52
+ // use puppeteerCli to download chrome
53
+ await this.installBrowser();
54
+ // set path to freshly installed chrome
55
+ this.userConfig.chromePath = this.getExecutablePathFromPuppeteer();
56
+ }
57
+ getExecutablePathFromPuppeteer() {
58
+ const puppeteerCache = new browsers_2.Cache(this.userConfig.tempFolder);
59
+ const installedBrowsers = puppeteerCache.getInstalledBrowsers();
60
+ return installedBrowsers[0].executablePath;
61
+ }
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(" ", "\\ ");
67
+ }
68
+ async installBrowser() {
69
+ const puppeteerCli = new browsers_1.CLI({
70
+ cachePath: this.userConfig.tempFolder,
71
+ scriptName: "@puppeteer/browsers",
72
+ version: version_js_1.packageVersion,
73
+ prefixCommand: {
74
+ cmd: "browsers",
75
+ description: "Manage browsers of this Puppeteer installation",
76
+ },
77
+ allowCachePathOverride: false,
78
+ pinnedBrowsers: {
79
+ [browsers_1.Browser.CHROME]: {
80
+ buildId: "stable",
81
+ skipDownload: false,
82
+ },
83
+ },
84
+ });
85
+ // first two parameters would be npx puppeteer, when used outside sk-cli
86
+ await puppeteerCli.run(["", "", "browsers", "install"]);
87
+ }
88
+ }
89
+ exports.ExecutableValidator = ExecutableValidator;
90
+ //
@@ -42,6 +42,7 @@ 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
44
  const extension_downloader_1 = require("./browser/extension/extension-downloader");
45
+ const executable_validator_1 = require("./browser/executable/executable-validator");
45
46
  class OnboardingServiceFactory {
46
47
  context;
47
48
  cliConfig;
@@ -70,6 +71,8 @@ class OnboardingServiceFactory {
70
71
  const extensionDownloader = new extension_downloader_1.ExtensionDownloader(this.cliConfig, cli);
71
72
  const extensionPaths = await new extension_validator_1.ExtensionValidator(extensionDownloader, this.cliConfig, cli).getValidBrowserExtensionPaths();
72
73
  this.cliConfig.chromeExtensionPaths = extensionPaths.join(",");
74
+ const browserValidator = new executable_validator_1.ExecutableValidator(this.cliConfig, cli);
75
+ await browserValidator.validateOrInstall();
73
76
  const browserContext = new onboarding_model_1.BrowserContext(domainToStart, customerConfig.chromeFlags || [], this.cliConfig);
74
77
  const fileWatcher = new file_watcher_1.FileWatcher(cli, customerConfig, files, documentHandler, browserContext, cache);
75
78
  const athenaClient = (await this.getAthenaClient()) || null;
@@ -732,5 +732,5 @@
732
732
  ]
733
733
  }
734
734
  },
735
- "version": "3.3.0"
735
+ "version": "3.4.1"
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.3.0",
4
+ "version": "3.4.1",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"