@speedkit/cli 2.9.0 → 2.11.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +44 -63
  3. package/dist/commands/build-parameter-query.d.ts +4 -4
  4. package/dist/commands/build-parameter-query.js +38 -38
  5. package/dist/commands/build-prewarm-query.d.ts +4 -4
  6. package/dist/commands/build-prewarm-query.js +33 -34
  7. package/dist/commands/deploy.d.ts +4 -4
  8. package/dist/commands/deploy.js +14 -15
  9. package/dist/commands/find-pops.js +4 -4
  10. package/dist/commands/generate-pop-config.js +3 -3
  11. package/dist/commands/login.js +1 -1
  12. package/dist/commands/pop-prewarm.js +3 -3
  13. package/dist/commands/prewarm.js +4 -4
  14. package/dist/commands/wpt-launcher.js +2 -2
  15. package/dist/helpers/cli-config.d.ts +8 -7
  16. package/dist/helpers/cli-config.js +50 -44
  17. package/dist/models/cli-parameters.js +2 -2
  18. package/dist/services/cli/cli-service.d.ts +4 -4
  19. package/dist/services/config-api/client.js +1 -1
  20. package/dist/services/config-api-service.js +1 -1
  21. package/dist/services/deploy/context/deploy-context.d.ts +1 -4
  22. package/dist/services/deploy/context/deploy-context.js +6 -7
  23. package/dist/services/deploy/deploy-service-factory.d.ts +4 -5
  24. package/dist/services/deploy/deploy-service-factory.js +19 -18
  25. package/dist/services/integration-api/handler/customer-config-handler.d.ts +3 -3
  26. package/dist/services/integration-api/handler/customer-config-handler.js +21 -15
  27. package/dist/services/integration-api/struct/customer-config-file.d.ts +4 -3
  28. package/dist/services/integration-api/struct/customer-config-file.js +8 -6
  29. package/dist/services/onboarding/browser/abort-response.js +1 -1
  30. package/dist/services/onboarding/browser/baqend-response.d.ts +4 -4
  31. package/dist/services/onboarding/browser/baqend-response.js +33 -25
  32. package/dist/services/onboarding/browser/origin-response.d.ts +1 -1
  33. package/dist/services/onboarding/browser/origin-response.js +2 -3
  34. package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +4 -4
  35. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +44 -32
  36. package/dist/services/onboarding/dashboard/athena-service.d.ts +2 -2
  37. package/dist/services/onboarding/dashboard/athena-service.js +28 -23
  38. package/dist/services/onboarding/dashboard/index.d.ts +3 -3
  39. package/dist/services/onboarding/dashboard/index.js +48 -36
  40. package/dist/services/onboarding/dashboard/param-query-builder.d.ts +2 -2
  41. package/dist/services/onboarding/dashboard/param-query-builder.js +2 -2
  42. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +1 -1
  43. package/dist/services/onboarding/dashboard/request-diff-service.js +32 -28
  44. package/dist/services/onboarding/fetch-event-handler.d.ts +6 -6
  45. package/dist/services/onboarding/fetch-event-handler.js +72 -62
  46. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +8 -8
  47. package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +51 -49
  48. package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +3 -3
  49. package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +6 -6
  50. package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +2 -2
  51. package/dist/services/onboarding/fetch-events/dashboard-request.js +3 -3
  52. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +7 -7
  53. package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +76 -59
  54. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +3 -3
  55. package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +14 -14
  56. package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +6 -6
  57. package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +12 -10
  58. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +7 -7
  59. package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +3 -3
  60. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +4 -4
  61. package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +6 -4
  62. package/dist/services/onboarding/file-events/{fileWatcher.d.ts → file-watcher.d.ts} +9 -8
  63. package/dist/services/onboarding/file-events/{fileWatcher.js → file-watcher.js} +74 -56
  64. package/dist/services/onboarding/index.d.ts +3 -3
  65. package/dist/services/onboarding/onboarding-model.d.ts +36 -34
  66. package/dist/services/onboarding/onboarding-model.js +19 -19
  67. package/dist/services/onboarding/onboarding-service-factory.d.ts +6 -6
  68. package/dist/services/onboarding/onboarding-service-factory.js +80 -75
  69. package/dist/services/onboarding/onboarding-service.d.ts +7 -7
  70. package/dist/services/onboarding/onboarding-service.js +54 -48
  71. package/dist/services/onboarding/request-cache/cache.d.ts +3 -3
  72. package/dist/services/onboarding/request-cache/cache.js +7 -7
  73. package/dist/services/onboarding/server-config/index.js +2 -2
  74. package/dist/services/onboarding/todo-collector.d.ts +1 -1
  75. package/dist/services/onboarding/todo-collector.js +8 -6
  76. package/dist/services/prewarm-service.js +2 -2
  77. package/oclif.manifest.json +9 -9
  78. package/package.json +24 -23
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # [2.11.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.10.0...v2.11.0) (2024-03-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **onboarding:** fix wrong path to fileEventHandler) ([6be965a](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/6be965ac4155cb139162f7fc615e5911cca02c5a))
7
+
8
+
9
+ ### Features
10
+
11
+ * **docs:** update readme ([f658a14](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/f658a1477d7f22a3429ef94483857a50e74d4b0b))
12
+ * **onboarding:** enable use of chrome extensions ([ad54021](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/ad540216fe79a8ad049a9ba676e5627b415e49c4))
13
+ * **userCliConfig:** make use of userConfig overall' ([5e5b1e7](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/5e5b1e764bafd0c09282799f32bda13dde86df1a))
14
+
15
+ # [2.10.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.9.0...v2.10.0) (2024-03-15)
16
+
17
+
18
+ ### Features
19
+
20
+ * update dependencies ([30f8889](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/30f88894848e224546747d1aeed566ea15607bb9))
21
+
1
22
  # [2.9.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.8.0...v2.9.0) (2024-03-15)
2
23
 
3
24
 
package/README.md CHANGED
@@ -1,86 +1,67 @@
1
1
  speed-kit-cli
2
2
  =============
3
3
 
4
- Speed Kit CLI
5
-
6
4
  [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
7
5
  [![Version](https://img.shields.io/npm/v/speed-kit-cli.svg)](https://npmjs.org/package/speed-kit-cli)
8
6
  [![Downloads/week](https://img.shields.io/npm/dw/speed-kit-cli.svg)](https://npmjs.org/package/speed-kit-cli)
9
7
  [![License](https://img.shields.io/npm/l/speed-kit-cli.svg)](https://github.com/baqend/speed-kit-cli/blob/master/package.json)
10
8
 
11
- ## Configuration:
12
- via envVars:
13
- ```shell
14
- $CHROME_PATH # path to chromeBinary
15
- $CHROME_USER_PROFILE_PATH # path to save custom chromeUserProfile
16
- $SLACK_TOKEN # slackToken that will be injected in deploymentDetection
17
- $SPEED_KIT_EXTENSION_PATH # path to speedKitDevtoolsBrowserExtension
18
- $TEST_APP # name of your testApp
19
- $IDEA_INITIAL_DIRECTORY # directoryPath to intellij shellBinary
20
- $DIFF_EXEC # path or executable of you favorite diffTool e.g. "vscode --diff", "codium --diff", "diff", "idea diff"
21
- DIFF_EXEC_TEMPLATE # defaults to "$exec $file1 $file2" resolves in "diff pathToFile1 pathToFile2"
22
- ```
23
- or via config file:
24
- Unix: ~/.config/speed-kit-cli/config.json
25
- Windows: %LOCALAPPDATA%\speed-kit-cli/config.json
26
-
27
- ```javascript
28
- {
29
- "chromePath": "", //path to chromeBinary
30
- "chromeUserProfilePath": "", //path to save custom chromeUserProfile
31
- "slackToken": "", //slackToken that will be injected in deploymentDetection
32
- "speedKitBrowserExtensionPath": "", //path to speedKitDevtoolsBrowserExtension
33
- "testApp": "", //name of your testApp
34
- "ideaDirectory": "", //directoryPath to intellij shellBinary
35
- "diffExec": "" // path or executable of you favorite diffTool e.g. "vscode --diff", "codium --diff", "diff", "idea diff"
36
- "diffExecTemplate": "" // defaults to "$exec $file1 $file2" resolves in "diff pathToFile1 pathToFile2"
37
- }
38
- ```
39
- example for diffing with intellij:
40
- ```javascript
41
- {
42
- "diffExec": "idea diff"
43
- "diffExecTemplate": ""
44
- }
45
-
46
- ```
47
-
48
- example for diffing with VSCodium:
49
- ```javascript
50
- {
51
- "diffExec": "codium"
52
- "diffExecTemplate": "$exec --diff $file1 $file2"
53
- }
54
-
55
- ```
56
-
57
- example for changing the order of files to diff:
58
- ```javascript
59
- {
60
- "diffExecTemplate": "$exec $file2 $file1"
61
- }
62
- ```
9
+ ## Quicklinks
63
10
 
64
- ---
65
-
66
11
  <!-- toc -->
67
12
  * [Usage](#usage)
68
13
  * [Commands](#commands)
69
14
  <!-- tocstop -->
15
+ * [Contributing](./CONTRIBUTING.md)
16
+ * [Changelog](./CHANGELOG.md)
17
+
70
18
  # Usage
19
+
71
20
  <!-- usage -->
72
21
  ```sh-session
73
22
  $ npm install -g @speedkit/cli
74
23
  $ sk COMMAND
75
24
  running command...
76
25
  $ sk (--version)
77
- @speedkit/cli/2.9.0 linux-x64 node-v20.11.1
26
+ @speedkit/cli/2.11.0 linux-x64 node-v20.11.1
78
27
  $ sk --help [COMMAND]
79
28
  USAGE
80
29
  $ sk COMMAND
81
30
  ...
82
31
  ```
83
32
  <!-- usagestop -->
33
+
34
+ ## Configure
35
+
36
+ There are two different ways of configuring the CLI:
37
+ - [Using Config File (recommended)](#using-config-file-recommended)
38
+ - [Using Environment Variables](#using-environment-variables)
39
+
40
+ ### Using Config File (recommended)
41
+
42
+ On the first execution of any `sk` command a `config.json` will be created and stored to the current user's directory of your OS:
43
+ - Unix: `~/.config/speed-kit-cli/config.json`
44
+ - Windows: `%LOCALAPPDATA%\speed-kit-cli\config.json`
45
+
46
+ ```json5
47
+ {
48
+ "chromePath": "", // local path to the Chrome binary
49
+ "chromeUserProfilePath": "", // local path to the Custom Chrome User Profile (use if you want to have Chrome's state saved)
50
+ "chromeExtensionPaths": "", // comma separated list of local paths to unpacked extensions for Chrome to load
51
+ "slackToken": "", // Slack token that will be injected to the deploymentDetection
52
+ "testApp": "", // name of your Test Speed Kit App
53
+ "ideaDirectory": "", // local directory path to the IntelliJ's shell binary
54
+ "diffExec": "", // path or executable of your favorite diff tool e.g. "vscode --diff", "codium --diff", "diff", "idea diff"
55
+ "diffExecTemplate": "" // defaults to "$exec $file1 $file2" resolves in "diff pathToFile1 pathToFile2"
56
+ }
57
+ ```
58
+
59
+ ### Using Environment Variables
60
+
61
+ By either...
62
+ - copying [.env.sample](./.env.sample) as `.env` to the directory of the cloned [sk-onboarding](https://gitlab.orestes.info/baqend/sk-onboarding)
63
+ - or by exporting [the listed variables](./.env.sample) to your shell as needed before using a specific CLI command.
64
+
84
65
  # Commands
85
66
  <!-- commands -->
86
67
  * [`sk autocomplete [SHELL]`](#sk-autocomplete-shell)
@@ -91,7 +72,7 @@ USAGE
91
72
  * [`sk find-pops APP`](#sk-find-pops-app)
92
73
  * [`sk generate-customer-config`](#sk-generate-customer-config)
93
74
  * [`sk generate-pop-config APP`](#sk-generate-pop-config-app)
94
- * [`sk help [COMMANDS]`](#sk-help-commands)
75
+ * [`sk help [COMMAND]`](#sk-help-command)
95
76
  * [`sk login [APP]`](#sk-login-app)
96
77
  * [`sk onboarding CUSTOMERPATH`](#sk-onboarding-customerpath)
97
78
  * [`sk param-diff PAGEURL`](#sk-param-diff-pageurl)
@@ -183,7 +164,7 @@ Deploys the specified customer config while comparing to the live version before
183
164
 
184
165
  ```
185
166
  USAGE
186
- $ sk deploy CUSTOMERPATH [-c <value>] [-t <value>] [-a <value>] [-d]
167
+ $ sk deploy CUSTOMERPATH [-c <value>] [-a <value>] [-d] [-t <value>]
187
168
 
188
169
  ARGUMENTS
189
170
  CUSTOMERPATH The customer config path
@@ -309,16 +290,16 @@ EXAMPLES
309
290
  $ sk generate-pop-config --coverage 95 --pop-limit 6 --traffic-share 2 --deploy appName
310
291
  ```
311
292
 
312
- ## `sk help [COMMANDS]`
293
+ ## `sk help [COMMAND]`
313
294
 
314
295
  Display help for sk.
315
296
 
316
297
  ```
317
298
  USAGE
318
- $ sk help [COMMANDS] [-n]
299
+ $ sk help [COMMAND] [-n]
319
300
 
320
301
  ARGUMENTS
321
- COMMANDS Command to show help for.
302
+ COMMAND Command to show help for.
322
303
 
323
304
  FLAGS
324
305
  -n, --nested-commands Include all nested commands in the output.
@@ -327,7 +308,7 @@ DESCRIPTION
327
308
  Display help for sk.
328
309
  ```
329
310
 
330
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.5/src/commands/help.ts)_
311
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.18/src/commands/help.ts)_
331
312
 
332
313
  ## `sk login [APP]`
333
314
 
@@ -1,15 +1,15 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class BuildParameterQuery extends Command {
3
- static description: string;
4
3
  static args: {
5
4
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
5
  exists?: boolean;
7
6
  }>;
8
7
  };
8
+ static description: string;
9
+ static examples: string[];
9
10
  static flags: {
10
11
  configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
12
  };
12
- static examples: string[];
13
- run(): Promise<void>;
14
13
  buildParameterQuery(app: string, parameterFilter: string, whitelistedFilter: string, blacklistedFilter: string, parameterReplaceFilter: string): string;
14
+ run(): Promise<void>;
15
15
  }
@@ -4,55 +4,25 @@ const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
6
  const clipboardy_cjs_1 = tslib_1.__importDefault(require("clipboardy-cjs"));
7
- const cli_parameters_1 = require("../models/cli-parameters");
7
+ const CustomerConfig_1 = require("../helpers/CustomerConfig");
8
8
  const build_query_helper_1 = require("../helpers/build-query-helper");
9
9
  const get_parsed_config_1 = require("../helpers/get-parsed-config");
10
- const CustomerConfig_1 = require("../helpers/CustomerConfig");
11
10
  const logging_helper_1 = require("../helpers/logging-helper");
11
+ const cli_parameters_1 = require("../models/cli-parameters");
12
12
  class BuildParameterQuery extends core_1.Command {
13
- static description = 'Build a parameter query that can be executed in Athena';
14
13
  static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
15
- static flags = {
16
- ...cli_parameters_1.CLI_CONFIG_NAME
17
- };
14
+ static description = "Build a parameter query that can be executed in Athena";
18
15
  static examples = [
19
16
  `$ sk build-parameter-query <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}>`,
20
17
  `$ sk build-parameter-query ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName}`,
21
18
  ];
22
- async run() {
23
- const { args: { customerPath }, flags: { configName } } = await this.parse(BuildParameterQuery);
24
- core_1.ux.action.start('Building parameter query');
25
- try {
26
- const { app, config } = await CustomerConfig_1.CustomerConfig.loadCustomer(customerPath, configName);
27
- const parsedConfig = await (0, get_parsed_config_1.getParsedConfig)(config);
28
- const params = (0, build_query_helper_1.getStrippedParams)(parsedConfig);
29
- const skConfigVersion = (0, get_parsed_config_1.getSpeedKitConfigVersion)(parsedConfig);
30
- const parameterFilter = (0, build_query_helper_1.getParameterFilter)(params, skConfigVersion);
31
- const parameterReplaceFilter = (0, build_query_helper_1.getParameterReplaceFilter)(params, skConfigVersion);
32
- const whitelistedFilter = (0, build_query_helper_1.getWhitelistedFilter)(parsedConfig);
33
- const blacklistedFilter = (0, build_query_helper_1.getBlacklistedFilter)(parsedConfig);
34
- const result = this.buildParameterQuery(app || parsedConfig.appName, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter);
35
- if (!this.config.windows) {
36
- clipboardy_cjs_1.default.writeSync(result);
37
- }
38
- console.log(chalk_1.default.dim.italic(result));
39
- console.log('');
40
- core_1.ux.action.stop();
41
- console.log('');
42
- if (!this.config.windows) {
43
- (0, logging_helper_1.logInfo)('Result has been copied to the clipboard 📋');
44
- }
45
- }
46
- catch (e) {
47
- console.log('');
48
- (0, logging_helper_1.logError)(e.stack);
49
- }
50
- console.log('');
51
- }
19
+ static flags = {
20
+ ...cli_parameters_1.CLI_CONFIG_NAME,
21
+ };
52
22
  buildParameterQuery(app, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
53
23
  const nowMinusOneMonth = new Date(new Date().setMonth(new Date().getMonth() - 1, new Date().getDate()));
54
- const monthString = `${nowMinusOneMonth.getMonth() + 1 < 10 ? '0' : ''}${nowMinusOneMonth.getMonth() + 1}`;
55
- const dateString = `${nowMinusOneMonth.getDate() < 10 ? '0' : ''}${nowMinusOneMonth.getDate()}`;
24
+ const monthString = `${nowMinusOneMonth.getMonth() + 1 < 10 ? "0" : ""}${nowMinusOneMonth.getMonth() + 1}`;
25
+ const dateString = `${nowMinusOneMonth.getDate() < 10 ? "0" : ""}${nowMinusOneMonth.getDate()}`;
56
26
  const date = `${nowMinusOneMonth.getFullYear()}-${monthString}-${dateString}`;
57
27
  return `
58
28
  with urlWithParams as (
@@ -91,5 +61,35 @@ from prepared
91
61
  where cardinality(paramKeys) > 0
92
62
  order by potentialGain desc, cachedUrls desc, PIs desc`;
93
63
  }
64
+ async run() {
65
+ const { args: { customerPath }, flags: { configName }, } = await this.parse(BuildParameterQuery);
66
+ core_1.ux.action.start("Building parameter query");
67
+ try {
68
+ const { app, config } = await CustomerConfig_1.CustomerConfig.loadCustomer(customerPath, configName);
69
+ const parsedConfig = await (0, get_parsed_config_1.getParsedConfig)(config);
70
+ const params = (0, build_query_helper_1.getStrippedParams)(parsedConfig);
71
+ const skConfigVersion = (0, get_parsed_config_1.getSpeedKitConfigVersion)(parsedConfig);
72
+ const parameterFilter = (0, build_query_helper_1.getParameterFilter)(params, skConfigVersion);
73
+ const parameterReplaceFilter = (0, build_query_helper_1.getParameterReplaceFilter)(params, skConfigVersion);
74
+ const whitelistedFilter = (0, build_query_helper_1.getWhitelistedFilter)(parsedConfig);
75
+ const blacklistedFilter = (0, build_query_helper_1.getBlacklistedFilter)(parsedConfig);
76
+ const result = this.buildParameterQuery(app || parsedConfig.appName, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter);
77
+ if (!this.config.windows) {
78
+ clipboardy_cjs_1.default.writeSync(result);
79
+ }
80
+ console.log(chalk_1.default.dim.italic(result));
81
+ console.log("");
82
+ core_1.ux.action.stop();
83
+ console.log("");
84
+ if (!this.config.windows) {
85
+ (0, logging_helper_1.logInfo)("Result has been copied to the clipboard 📋");
86
+ }
87
+ }
88
+ catch (error) {
89
+ console.log("");
90
+ (0, logging_helper_1.logError)(error.stack);
91
+ }
92
+ console.log("");
93
+ }
94
94
  }
95
95
  exports.default = BuildParameterQuery;
@@ -1,15 +1,15 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class BuildPrewarmQuery extends Command {
3
- static description: string;
4
3
  static args: {
5
4
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
5
  exists?: boolean;
7
6
  }>;
8
7
  };
8
+ static description: string;
9
+ static examples: string[];
9
10
  static flags: {
10
11
  configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
12
  };
12
- static examples: string[];
13
- run(): Promise<void>;
14
13
  buildPrewarmQuery(app: string, whitelistedFilter: string, blacklistedFilter: string, parameterReplaceFilter: string): string;
14
+ run(): Promise<void>;
15
15
  }
@@ -2,27 +2,43 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
- const core_2 = require("@oclif/core");
6
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
6
  const clipboardy_cjs_1 = tslib_1.__importDefault(require("clipboardy-cjs"));
8
- const cli_parameters_1 = require("../models/cli-parameters");
7
+ const CustomerConfig_1 = require("../helpers/CustomerConfig");
9
8
  const build_query_helper_1 = require("../helpers/build-query-helper");
10
9
  const get_parsed_config_1 = require("../helpers/get-parsed-config");
11
10
  const logging_helper_1 = require("../helpers/logging-helper");
12
- const CustomerConfig_1 = require("../helpers/CustomerConfig");
11
+ const cli_parameters_1 = require("../models/cli-parameters");
13
12
  class BuildPrewarmQuery extends core_1.Command {
14
- static description = 'Build a prewarm query that can be executed in Athena';
15
13
  static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
16
- static flags = {
17
- ...cli_parameters_1.CLI_CONFIG_NAME
18
- };
14
+ static description = "Build a prewarm query that can be executed in Athena";
19
15
  static examples = [
20
16
  `$ sk build-prewarm-query <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}>`,
21
17
  `$ sk build-prewarm-query ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName}`,
22
18
  ];
19
+ static flags = {
20
+ ...cli_parameters_1.CLI_CONFIG_NAME,
21
+ };
22
+ buildPrewarmQuery(app, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
23
+ const now = new Date();
24
+ now.setDate(now.getDate() - 10);
25
+ const date = now.toISOString().split("T")[0];
26
+ return `
27
+ select url
28
+ from (
29
+ select regexp_replace(regexp_replace(${parameterReplaceFilter}, '(^[^&?]*)&','$1?'), '\\?$','') as url,
30
+ uadevice
31
+ from live.rum.pi
32
+ where app = '${app}'
33
+ and date >= '${date}'
34
+ and ${whitelistedFilter}
35
+ and ${blacklistedFilter})
36
+ group by url
37
+ order by count(*) desc`;
38
+ }
23
39
  async run() {
24
- const { args: { customerPath }, flags: { configName } } = await this.parse(BuildPrewarmQuery);
25
- core_2.ux.action.start('Building pre-warm query');
40
+ const { args: { customerPath }, flags: { configName }, } = await this.parse(BuildPrewarmQuery);
41
+ core_1.ux.action.start("Building pre-warm query");
26
42
  try {
27
43
  const { app, config } = await CustomerConfig_1.CustomerConfig.loadCustomer(customerPath, configName);
28
44
  const parsedConfig = await (0, get_parsed_config_1.getParsedConfig)(config);
@@ -35,35 +51,18 @@ class BuildPrewarmQuery extends core_1.Command {
35
51
  clipboardy_cjs_1.default.writeSync(result);
36
52
  }
37
53
  console.log(chalk_1.default.dim.italic(result));
38
- console.log('');
39
- core_2.ux.action.stop();
40
- console.log('');
54
+ console.log("");
55
+ core_1.ux.action.stop();
56
+ console.log("");
41
57
  if (!this.config.windows) {
42
- (0, logging_helper_1.logInfo)('Result has been copied to the clipboard 📋');
58
+ (0, logging_helper_1.logInfo)("Result has been copied to the clipboard 📋");
43
59
  }
44
60
  }
45
- catch (e) {
46
- console.log('');
47
- (0, logging_helper_1.logError)(e.stack);
61
+ catch (error) {
62
+ console.log("");
63
+ (0, logging_helper_1.logError)(error.stack);
48
64
  }
49
- console.log('');
50
- }
51
- buildPrewarmQuery(app, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
52
- const now = new Date();
53
- now.setDate(now.getDate() - 10);
54
- const date = now.toISOString().split('T')[0];
55
- return `
56
- select url
57
- from (
58
- select regexp_replace(regexp_replace(${parameterReplaceFilter}, '(^[^&?]*)&','$1?'), '\\?$','') as url,
59
- uadevice
60
- from live.rum.pi
61
- where app = '${app}'
62
- and date >= '${date}'
63
- and ${whitelistedFilter}
64
- and ${blacklistedFilter})
65
- group by url
66
- order by count(*) desc`;
65
+ console.log("");
67
66
  }
68
67
  }
69
68
  exports.default = BuildPrewarmQuery;
@@ -1,17 +1,17 @@
1
- import { Command } from '@oclif/core';
1
+ import { Command } from "@oclif/core";
2
2
  export default class Deploy extends Command {
3
- static description: string;
4
3
  static args: {
5
4
  customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
6
5
  exists?: boolean;
7
6
  }>;
8
7
  };
8
+ static description: string;
9
+ static examples: string[];
9
10
  static flags: {
10
- slackToken: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
11
  artifacts: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
12
12
  dryRun: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
+ slackToken: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
13
14
  configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
14
15
  };
15
- static examples: string[];
16
16
  run(): Promise<void>;
17
17
  }
@@ -1,36 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- /* eslint-disable valid-jsdoc, no-await-in-loop */
5
4
  const core_1 = require("@oclif/core");
5
+ const cli_config_1 = require("../helpers/cli-config");
6
6
  const cli_parameters_1 = require("../models/cli-parameters");
7
7
  const deploy_context_1 = tslib_1.__importDefault(require("../services/deploy/context/deploy-context"));
8
8
  const deploy_service_factory_1 = tslib_1.__importDefault(require("../services/deploy/deploy-service-factory"));
9
- const cli_config_1 = require("../helpers/cli-config");
10
9
  class Deploy extends core_1.Command {
11
- static description = 'Deploys the specified customer config while comparing to the live version before';
12
10
  static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
11
+ static description = "Deploys the specified customer config while comparing to the live version before";
12
+ static examples = [
13
+ `$ sk deploy <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}> -${cli_parameters_1.CLIParametersChar.SlackToken} <${cli_parameters_1.CLIParameters.SlackToken}> -${cli_parameters_1.CLIParametersChar.Artifacts} <${cli_parameters_1.CLIParameters.Artifacts}> -${cli_parameters_1.CLIParametersChar.DryRun} <${cli_parameters_1.CLIParameters.DryRun}>`,
14
+ `$ sk deploy ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName} -${cli_parameters_1.CLIParametersChar.SlackToken} ${cli_parameters_1.CLIParametersExample.SlackToken} -${cli_parameters_1.CLIParametersChar.Artifacts} ${cli_parameters_1.CLIParametersExample.Artifacts} -${cli_parameters_1.CLIParametersChar.DryRun}`,
15
+ ];
13
16
  static flags = {
14
17
  ...cli_parameters_1.CLI_CONFIG_NAME,
15
- [cli_parameters_1.CLIParameters.SlackToken]: core_1.Flags.string({
16
- description: 'Slack hook found on 1Pass',
17
- char: cli_parameters_1.CLIParametersChar.SlackToken
18
- }),
19
18
  [cli_parameters_1.CLIParameters.Artifacts]: core_1.Flags.string({
20
- description: 'Whitelist of files to deploy',
21
- char: cli_parameters_1.CLIParametersChar.Artifacts
19
+ char: cli_parameters_1.CLIParametersChar.Artifacts,
20
+ description: "Whitelist of files to deploy",
22
21
  }),
23
22
  [cli_parameters_1.CLIParameters.DryRun]: core_1.Flags.boolean({
24
- description: 'Do not deploy changes',
25
23
  char: cli_parameters_1.CLIParametersChar.DryRun,
24
+ description: "Do not deploy changes",
25
+ }),
26
+ [cli_parameters_1.CLIParameters.SlackToken]: core_1.Flags.string({
27
+ char: cli_parameters_1.CLIParametersChar.SlackToken,
28
+ description: "Slack hook found on 1Pass",
26
29
  }),
27
30
  };
28
- static examples = [
29
- `$ sk deploy <${cli_parameters_1.CLIParameters.CustomerPath}> -${cli_parameters_1.CLIParametersChar.ConfigName} <${cli_parameters_1.CLIParameters.ConfigName}> -${cli_parameters_1.CLIParametersChar.SlackToken} <${cli_parameters_1.CLIParameters.SlackToken}> -${cli_parameters_1.CLIParametersChar.Artifacts} <${cli_parameters_1.CLIParameters.Artifacts}> -${cli_parameters_1.CLIParametersChar.DryRun} <${cli_parameters_1.CLIParameters.DryRun}>`,
30
- `$ sk deploy ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName} -${cli_parameters_1.CLIParametersChar.SlackToken} ${cli_parameters_1.CLIParametersExample.SlackToken} -${cli_parameters_1.CLIParametersChar.Artifacts} ${cli_parameters_1.CLIParametersExample.Artifacts} -${cli_parameters_1.CLIParametersChar.DryRun}`,
31
- ];
32
31
  async run() {
33
- const { args: { customerPath }, flags: { configName, slackToken, artifacts, dryRun } } = await this.parse(Deploy);
32
+ const { args: { customerPath }, flags: { artifacts, configName, dryRun, slackToken }, } = await this.parse(Deploy);
34
33
  const deployContext = new deploy_context_1.default(customerPath, configName, slackToken, artifacts, dryRun);
35
34
  const deployService = await new deploy_service_factory_1.default(deployContext, new cli_config_1.CliConfig(this.config).load()).buildService();
36
35
  await deployService.run();
@@ -17,9 +17,9 @@ class FindPops extends core_1.Command {
17
17
  static description = 'Get IPs for all fastly PoPs';
18
18
  static args = {
19
19
  [cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
20
- name: cli_parameters_1.CLIParameters.AppName,
21
- required: true,
22
- description: 'The customers appName',
20
+ name: cli_parameters_1.CLIParameters.AppName, // name of arg to show in help and reference with args[name]
21
+ required: true, // make the arg required with `required: true`
22
+ description: 'The customers appName', // help description
23
23
  hidden: false, // hide this arg from help
24
24
  }),
25
25
  };
@@ -65,7 +65,7 @@ class FindPops extends core_1.Command {
65
65
  Host: `${app}.app.baqend.com`,
66
66
  authorization: `BAT ${token}`,
67
67
  },
68
- timeout: 10000,
68
+ timeout: 10_000,
69
69
  });
70
70
  const servedBy = resp.headers.get('x-served-by');
71
71
  if (resp.status !== 200 || !servedBy) {
@@ -68,9 +68,9 @@ const percentageFormatter = new Intl.NumberFormat("en-US", {
68
68
  class GeneratePopConfig extends core_1.Command {
69
69
  static args = {
70
70
  [cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
71
- description: "The customers appName",
72
- hidden: false,
73
- name: cli_parameters_1.CLIParameters.AppName,
71
+ description: "The customers appName", // help description
72
+ hidden: false, // hide this arg from help
73
+ name: cli_parameters_1.CLIParameters.AppName, // name of arg to show in help and reference with args[name]
74
74
  required: true, // make the arg required with `required: true`
75
75
  }),
76
76
  };
@@ -10,7 +10,7 @@ class Login extends core_1.Command {
10
10
  static description = 'Login to your app';
11
11
  static args = {
12
12
  [cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
13
- name: cli_parameters_1.CLIParameters.AppName,
13
+ name: cli_parameters_1.CLIParameters.AppName, // name of arg to show in help and reference with args[name]
14
14
  required: false,
15
15
  default: 'bbq',
16
16
  description: 'The customers appName', // help description
@@ -11,9 +11,9 @@ class PopPrewarm extends core_1.Command {
11
11
  static description = 'Pre-warm Fastly PoPs';
12
12
  static args = {
13
13
  [cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
14
- name: cli_parameters_1.CLIParameters.AppName,
15
- required: true,
16
- description: 'The customers appName',
14
+ name: cli_parameters_1.CLIParameters.AppName, // name of arg to show in help and reference with args[name]
15
+ required: true, // make the arg required with `required: true`
16
+ description: 'The customers appName', // help description
17
17
  hidden: false, // hide this arg from help
18
18
  }),
19
19
  };
@@ -13,13 +13,13 @@ class Prewarm extends core_1.Command {
13
13
  static description = 'Pre-warm Fastly';
14
14
  static args = {
15
15
  [cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
16
- name: cli_parameters_1.CLIParameters.AppName,
17
- required: true,
16
+ name: cli_parameters_1.CLIParameters.AppName, // name of arg to show in help and reference with args[name]
17
+ required: true, // make the arg required with `required: true`
18
18
  description: 'The customer app name', // help description
19
19
  }),
20
20
  [cli_parameters_1.CLIParameters.Path]: core_1.Args.string({
21
- name: cli_parameters_1.CLIParameters.Path,
22
- required: true,
21
+ name: cli_parameters_1.CLIParameters.Path, // name of arg to show in help and reference with args[name]
22
+ required: true, // make the arg required with `required: true`
23
23
  description: 'path to prewarmFile', // help description
24
24
  }),
25
25
  };
@@ -9,11 +9,11 @@ class WptLauncher extends core_1.Command {
9
9
  static description = 'Analyze the performance impact that Speed Kit has compared to the original version.';
10
10
  static args = {
11
11
  [cli_parameters_1.CLIParameters.Urls]: core_1.Args.string({
12
- name: cli_parameters_1.CLIParameters.Urls,
12
+ name: cli_parameters_1.CLIParameters.Urls, // name of arg to show in help and reference with args[name]
13
13
  required: true, // make the arg required with `required: true`
14
14
  }),
15
15
  [cli_parameters_1.CLIParameters.TestId]: core_1.Args.string({
16
- name: cli_parameters_1.CLIParameters.TestId,
16
+ name: cli_parameters_1.CLIParameters.TestId, // name of arg to show in help and reference with args[name]
17
17
  required: true, // make the arg required with `required: true`
18
18
  }),
19
19
  };
@@ -1,22 +1,23 @@
1
1
  import { Config } from "@oclif/core/lib/config";
2
2
  export type UserCliConfig = {
3
+ chromeExtensionPaths: string;
3
4
  chromePath: string;
4
5
  chromeUserProfilePath: string;
5
- slackToken: string;
6
- speedKitBrowserExtensionPath: string;
7
- testApp: string;
8
- ideaDirectory: string;
9
6
  diffExec: string;
10
7
  diffExecTemplate: string;
8
+ ideaDirectory: string;
9
+ slackToken: string;
10
+ testApp: string;
11
11
  };
12
12
  export declare class CliConfig {
13
13
  private config;
14
14
  private userCliConfig;
15
15
  constructor(config: Config);
16
16
  load(): UserCliConfig;
17
- private loadConfigFromEnvironment;
18
- private getConfigFilePath;
19
- private loadConfigFromConfigFile;
20
17
  private createEmptyConfigFile;
21
18
  private createEmptyUserConfig;
19
+ private getConfigFilePath;
20
+ private loadConfigFromConfigFile;
21
+ private loadConfigFromEnvironment;
22
+ private readCliConfigFromFile;
22
23
  }