@speedkit/cli 2.10.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.
- package/CHANGELOG.md +14 -0
- package/README.md +39 -58
- package/dist/commands/build-parameter-query.d.ts +4 -4
- package/dist/commands/build-parameter-query.js +38 -38
- package/dist/commands/build-prewarm-query.d.ts +4 -4
- package/dist/commands/build-prewarm-query.js +33 -34
- package/dist/commands/deploy.d.ts +4 -4
- package/dist/commands/deploy.js +14 -15
- package/dist/helpers/cli-config.d.ts +8 -7
- package/dist/helpers/cli-config.js +50 -44
- package/dist/services/cli/cli-service.d.ts +1 -1
- package/dist/services/deploy/context/deploy-context.d.ts +1 -4
- package/dist/services/deploy/context/deploy-context.js +6 -7
- package/dist/services/deploy/deploy-service-factory.d.ts +4 -5
- package/dist/services/deploy/deploy-service-factory.js +19 -18
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +3 -3
- package/dist/services/integration-api/handler/customer-config-handler.js +20 -14
- package/dist/services/integration-api/struct/customer-config-file.d.ts +4 -3
- package/dist/services/integration-api/struct/customer-config-file.js +7 -5
- package/dist/services/onboarding/browser/abort-response.js +1 -1
- package/dist/services/onboarding/browser/baqend-response.d.ts +4 -4
- package/dist/services/onboarding/browser/baqend-response.js +33 -25
- package/dist/services/onboarding/browser/origin-response.d.ts +1 -1
- package/dist/services/onboarding/browser/origin-response.js +2 -3
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.d.ts +4 -4
- package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +44 -32
- package/dist/services/onboarding/dashboard/athena-service.d.ts +2 -2
- package/dist/services/onboarding/dashboard/athena-service.js +28 -23
- package/dist/services/onboarding/dashboard/index.d.ts +3 -3
- package/dist/services/onboarding/dashboard/index.js +48 -36
- package/dist/services/onboarding/dashboard/param-query-builder.d.ts +2 -2
- package/dist/services/onboarding/dashboard/param-query-builder.js +2 -2
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +1 -1
- package/dist/services/onboarding/dashboard/request-diff-service.js +32 -28
- package/dist/services/onboarding/fetch-event-handler.d.ts +6 -6
- package/dist/services/onboarding/fetch-event-handler.js +72 -62
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +8 -8
- package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +51 -49
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/customer-service-worker-js.js +6 -6
- package/dist/services/onboarding/fetch-events/dashboard-request.d.ts +2 -2
- package/dist/services/onboarding/fetch-events/dashboard-request.js +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.d.ts +7 -7
- package/dist/services/onboarding/fetch-events/speed-kit-asset-request.js +76 -59
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +14 -14
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.d.ts +6 -6
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +12 -10
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +7 -7
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +3 -3
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +4 -4
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +6 -4
- package/dist/services/onboarding/file-events/{fileWatcher.d.ts → file-watcher.d.ts} +9 -8
- package/dist/services/onboarding/file-events/{fileWatcher.js → file-watcher.js} +74 -56
- package/dist/services/onboarding/index.d.ts +3 -3
- package/dist/services/onboarding/onboarding-model.d.ts +36 -34
- package/dist/services/onboarding/onboarding-model.js +19 -19
- package/dist/services/onboarding/onboarding-service-factory.d.ts +6 -6
- package/dist/services/onboarding/onboarding-service-factory.js +80 -75
- package/dist/services/onboarding/onboarding-service.d.ts +7 -7
- package/dist/services/onboarding/onboarding-service.js +54 -48
- package/dist/services/onboarding/request-cache/cache.d.ts +3 -3
- package/dist/services/onboarding/request-cache/cache.js +7 -7
- package/dist/services/onboarding/server-config/index.js +2 -2
- package/dist/services/onboarding/todo-collector.d.ts +1 -1
- package/dist/services/onboarding/todo-collector.js +8 -6
- package/oclif.manifest.json +9 -9
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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
|
+
|
|
1
15
|
# [2.10.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.9.0...v2.10.0) (2024-03-15)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -1,86 +1,67 @@
|
|
|
1
1
|
speed-kit-cli
|
|
2
2
|
=============
|
|
3
3
|
|
|
4
|
-
Speed Kit CLI
|
|
5
|
-
|
|
6
4
|
[](https://oclif.io)
|
|
7
5
|
[](https://npmjs.org/package/speed-kit-cli)
|
|
8
6
|
[](https://npmjs.org/package/speed-kit-cli)
|
|
9
7
|
[](https://github.com/baqend/speed-kit-cli/blob/master/package.json)
|
|
10
8
|
|
|
11
|
-
##
|
|
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.
|
|
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)
|
|
@@ -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>] [-
|
|
167
|
+
$ sk deploy CUSTOMERPATH [-c <value>] [-a <value>] [-d] [-t <value>]
|
|
187
168
|
|
|
188
169
|
ARGUMENTS
|
|
189
170
|
CUSTOMERPATH The customer config path
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Command } from
|
|
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
|
|
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
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 ?
|
|
55
|
-
const dateString = `${nowMinusOneMonth.getDate() < 10 ?
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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)(
|
|
58
|
+
(0, logging_helper_1.logInfo)("Result has been copied to the clipboard 📋");
|
|
43
59
|
}
|
|
44
60
|
}
|
|
45
|
-
catch (
|
|
46
|
-
console.log(
|
|
47
|
-
(0, logging_helper_1.logError)(
|
|
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
|
|
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
|
}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -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
|
-
|
|
21
|
-
|
|
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: {
|
|
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();
|
|
@@ -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
|
}
|
|
@@ -3,83 +3,89 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CliConfig = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
7
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
8
8
|
dotenv.config();
|
|
9
9
|
const envMapping = {
|
|
10
|
+
chromeExtensionPaths: "CHROME_EXTENSION_PATHS",
|
|
10
11
|
chromePath: "CHROME_PATH",
|
|
11
12
|
chromeUserProfilePath: "CHROME_USER_PROFILE_PATH",
|
|
12
|
-
slackToken: "SLACK_TOKEN",
|
|
13
|
-
speedKitBrowserExtensionPath: "SPEED_KIT_EXTENSION_PATH",
|
|
14
|
-
testApp: "TEST_APP",
|
|
15
|
-
ideaDirectory: "IDEA_INITIAL_DIRECTORY",
|
|
16
13
|
diffExec: "DIFF_EXEC",
|
|
17
14
|
diffExecTemplate: "DIFF_EXEC_TEMPLATE",
|
|
15
|
+
ideaDirectory: "IDEA_INITIAL_DIRECTORY",
|
|
16
|
+
slackToken: "SLACK_TOKEN",
|
|
17
|
+
testApp: "TEST_APP",
|
|
18
18
|
};
|
|
19
19
|
const CONFIG_FILE_NAME = "config.json";
|
|
20
20
|
class CliConfig {
|
|
21
21
|
config;
|
|
22
22
|
userCliConfig = {
|
|
23
|
+
chromeExtensionPaths: "",
|
|
23
24
|
chromePath: "",
|
|
24
25
|
chromeUserProfilePath: "",
|
|
25
|
-
slackToken: "",
|
|
26
|
-
speedKitBrowserExtensionPath: "",
|
|
27
|
-
testApp: "",
|
|
28
|
-
ideaDirectory: "",
|
|
29
26
|
diffExec: "",
|
|
30
27
|
diffExecTemplate: "$exec $file1 $file2",
|
|
28
|
+
ideaDirectory: "",
|
|
29
|
+
slackToken: "",
|
|
30
|
+
testApp: "",
|
|
31
31
|
};
|
|
32
32
|
constructor(config) {
|
|
33
33
|
this.config = config;
|
|
34
34
|
}
|
|
35
35
|
load() {
|
|
36
|
-
|
|
36
|
+
// load config from configFile
|
|
37
37
|
this.loadConfigFromConfigFile();
|
|
38
|
+
// override config from environment
|
|
39
|
+
this.loadConfigFromEnvironment();
|
|
38
40
|
return this.userCliConfig;
|
|
39
41
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
createEmptyConfigFile() {
|
|
43
|
+
node_fs_1.default.mkdirSync(node_path_1.default.resolve(this.config.configDir), { recursive: true });
|
|
44
|
+
node_fs_1.default.writeFileSync(this.getConfigFilePath(), JSON.stringify(this.createEmptyUserConfig(), null, `\t`));
|
|
45
|
+
}
|
|
46
|
+
createEmptyUserConfig() {
|
|
47
|
+
return {
|
|
48
|
+
chromeExtensionPaths: "",
|
|
49
|
+
chromePath: "",
|
|
50
|
+
chromeUserProfilePath: "",
|
|
51
|
+
diffExec: "",
|
|
52
|
+
ideaDirectory: "",
|
|
53
|
+
slackToken: "",
|
|
54
|
+
testApp: "",
|
|
55
|
+
};
|
|
47
56
|
}
|
|
48
57
|
getConfigFilePath() {
|
|
49
|
-
return
|
|
58
|
+
return node_path_1.default.resolve(this.config.configDir, CONFIG_FILE_NAME);
|
|
50
59
|
}
|
|
51
60
|
loadConfigFromConfigFile() {
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
const configJson = this.readCliConfigFromFile();
|
|
62
|
+
if (!configJson) {
|
|
54
63
|
return;
|
|
55
64
|
}
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
for (const key in configJson) {
|
|
60
|
-
if (configJson[key].length > 0) {
|
|
61
|
-
this.userCliConfig[key] = configJson[key];
|
|
62
|
-
}
|
|
65
|
+
for (const configKey in this.userCliConfig) {
|
|
66
|
+
if (configKey in configJson && configJson[configKey].length > 0) {
|
|
67
|
+
this.userCliConfig[configKey] = configJson[configKey];
|
|
63
68
|
}
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
loadConfigFromEnvironment() {
|
|
72
|
+
for (const configKey in this.userCliConfig) {
|
|
73
|
+
if (!(configKey in envMapping)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const envVar = envMapping[configKey];
|
|
77
|
+
if (envVar in process.env && process.env[envVar].length > 0) {
|
|
78
|
+
this.userCliConfig[configKey] = process.env[envVar];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
72
81
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
ideaDirectory: "",
|
|
81
|
-
diffExec: "",
|
|
82
|
-
};
|
|
82
|
+
readCliConfigFromFile() {
|
|
83
|
+
if (!node_fs_1.default.existsSync(this.getConfigFilePath())) {
|
|
84
|
+
this.createEmptyConfigFile();
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const configFileContent = node_fs_1.default.readFileSync(this.getConfigFilePath(), "utf8");
|
|
88
|
+
return JSON.parse(configFileContent);
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
91
|
exports.CliConfig = CliConfig;
|
|
@@ -9,7 +9,7 @@ export declare class CliService implements CliServiceInterface {
|
|
|
9
9
|
Color: ("white" | "black" | "blue" | "yellow" | "green" | "red" | "magenta" | "cyan" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "grey") | ("bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright" | "bgGrey");
|
|
10
10
|
ForegroundColor: "white" | "black" | "blue" | "yellow" | "green" | "red" | "magenta" | "cyan" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "grey";
|
|
11
11
|
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright" | "bgGrey";
|
|
12
|
-
Modifiers: "
|
|
12
|
+
Modifiers: "bold" | "hidden" | "underline" | "dim" | "italic" | "strikethrough" | "visible" | "reset" | "inverse";
|
|
13
13
|
stderr: chalk.Chalk & {
|
|
14
14
|
supportsColor: false | chalk.ColorSupport;
|
|
15
15
|
};
|