@speedkit/cli 2.8.0 → 2.10.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 +79 -0
- package/README.md +6 -6
- package/dist/commands/find-pops.js +4 -4
- package/dist/commands/generate-customer-config.d.ts +2 -2
- package/dist/commands/generate-customer-config.js +8 -8
- package/dist/commands/generate-pop-config.d.ts +4 -4
- package/dist/commands/generate-pop-config.js +153 -63
- package/dist/commands/login.js +1 -1
- package/dist/commands/pop-prewarm.js +3 -3
- package/dist/commands/prewarm.js +4 -4
- package/dist/commands/wpt-launcher.js +2 -2
- package/dist/dummy.spec.d.ts +1 -0
- package/dist/dummy.spec.js +19 -0
- package/dist/models/cli-parameters.js +2 -2
- package/dist/services/cli/cli-service.d.ts +4 -4
- package/dist/services/config-api/client.js +1 -1
- package/dist/services/config-api-service.js +1 -1
- package/dist/services/integration-api/handler/customer-config-handler.js +1 -1
- package/dist/services/integration-api/struct/customer-config-file.js +1 -1
- package/dist/services/onboarding/onboarding-service.js +1 -1
- package/dist/services/prewarm-service.js +2 -2
- package/oclif.manifest.json +1 -1
- package/package.json +39 -33
- package/bin/dev.cmd +0 -3
- package/bin/run.cmd +0 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# [2.10.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.9.0...v2.10.0) (2024-03-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* update dependencies ([30f8889](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/30f88894848e224546747d1aeed566ea15607bb9))
|
|
7
|
+
|
|
8
|
+
# [2.9.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.8.0...v2.9.0) (2024-03-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* adjust eslint configuration ([5d7a0b9](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/5d7a0b98615612a32f87208dbf7d5017996ab7ca))
|
|
14
|
+
|
|
15
|
+
# [2.8.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.7.0...v2.8.0) (2024-03-08)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **onboarding:** load serverConfig for documentHandlerRequests ([4953244](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/49532441ab1e927373be886d926e56231d04a6ae))
|
|
21
|
+
|
|
22
|
+
# [2.7.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.6.0...v2.7.0) (2024-03-06)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* optimise package json ([6b1b8b2](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/6b1b8b29a04e1ff08ff30e4d18c73168e8ca7aee))
|
|
28
|
+
|
|
29
|
+
# [2.6.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.5.0...v2.6.0) (2024-03-05)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Features
|
|
33
|
+
|
|
34
|
+
* add updateNotificationPlugin ([b81b4c0](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/b81b4c0575b81b52b541c4a30b43d6c9deaa17b5))
|
|
35
|
+
* **origins:** merge main ([4c43612](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/4c43612d403453809b10a2f3f7bd284364591373))
|
|
36
|
+
* **updateNotification:** add missing config ([bb33eda](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/bb33eda03ab129320e9c93960469bbb35cce09dc))
|
|
37
|
+
* **versionNotify:** update packageLockJson ([520b212](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/520b212543b78ea2d34e8eeafb44319e9785357a))
|
|
38
|
+
|
|
39
|
+
# [2.5.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.4.1...v2.5.0) (2024-03-05)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* **onboarding:** allow vmDocumentHandler to requestAllModules from outer NodeJs ([82dbeb1](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/82dbeb1a261e4a3b72f63f3a3576ee12f68c3912))
|
|
45
|
+
|
|
46
|
+
## [2.4.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.4.0...v2.4.1) (2024-03-01)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
* **customer-config:** update config customer template ([a69a47d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/a69a47de326b813650f5364bcd4cdfa1659b9563))
|
|
52
|
+
|
|
53
|
+
# [2.4.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.3.0...v2.4.0) (2024-03-01)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Features
|
|
57
|
+
|
|
58
|
+
* update dependencies ([ee809a7](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/ee809a7beb2077d6db5c150126964facf307e9a3))
|
|
59
|
+
|
|
60
|
+
# [2.3.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.2.0...v2.3.0) (2024-03-01)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Features
|
|
64
|
+
|
|
65
|
+
* **customer-config:** disable all sites by default ([b2c9e9d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/b2c9e9dcc20c98619691986191cff75843237f9b))
|
|
66
|
+
* **deploy:** merge main ([8f8aac2](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/8f8aac2119b9d02a25bf32a073f4a283d99d7f5a))
|
|
67
|
+
* **diff:** add diffExecutionTemplate ([04a8aa6](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/04a8aa6d4224ce142264a03905090c58ee59edf7))
|
|
68
|
+
* **documentHandler:** fix fileCreation on mac ([424c116](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/424c116887c2190d672b66d9e99b5d17cdc6eae6))
|
|
69
|
+
* **onboarding:** add support for predictive-preloading ([4ac6a21](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/4ac6a21f6603426e89628f5256bda9f0d7855d87))
|
|
70
|
+
* **pull:** add check for changed files ([3251875](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/3251875b36e717d63b0a60fc43a4dcdf9a5febd0))
|
|
71
|
+
* **pull:** add delete and create Actions ([306e46d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/306e46dcacdc52d9a36fd41359a276b7c58abfb7))
|
|
72
|
+
* **pull:** add delete- and createFileActions ([7e0e66e](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/7e0e66e498e117ed13e720e625f41adbb7b07e51))
|
|
73
|
+
* **pull:** add testingFramework ([35cc8ec](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/35cc8eca3f99c90174a3766e31e5d19730af912f))
|
|
74
|
+
* **pull:** merge main ([f73a729](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/f73a7298192b111b6245ac099b51ee57fa4a5c48))
|
|
75
|
+
* **pull:** remove tryCatch from pullCommand ([90b873c](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/90b873c2e2205b05d3670de8af7e842cef8ad395))
|
|
76
|
+
* **pullService:** add tests ([e07e7a9](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/e07e7a900d53e75fde1948666cd9a27926d5f302))
|
|
77
|
+
* **sync:** pull command ([8b2b43a](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/8b2b43a299f9b7ccb11779dacdabf1329cd6274f))
|
|
78
|
+
* **userConfig:** add configFile for cli ([b6e052e](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/b6e052e21a25b7b6800156977ed58b6ee5ecf93b))
|
|
79
|
+
* **userConfig:** update readme.md ([55a1f5b](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/55a1f5bb3ec816a2a38b429cd19fb8a1bc74c21d))
|
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ $ npm install -g @speedkit/cli
|
|
|
74
74
|
$ sk COMMAND
|
|
75
75
|
running command...
|
|
76
76
|
$ sk (--version)
|
|
77
|
-
@speedkit/cli/2.
|
|
77
|
+
@speedkit/cli/2.10.0 linux-x64 node-v20.11.1
|
|
78
78
|
$ sk --help [COMMAND]
|
|
79
79
|
USAGE
|
|
80
80
|
$ sk COMMAND
|
|
@@ -91,7 +91,7 @@ USAGE
|
|
|
91
91
|
* [`sk find-pops APP`](#sk-find-pops-app)
|
|
92
92
|
* [`sk generate-customer-config`](#sk-generate-customer-config)
|
|
93
93
|
* [`sk generate-pop-config APP`](#sk-generate-pop-config-app)
|
|
94
|
-
* [`sk help [
|
|
94
|
+
* [`sk help [COMMAND]`](#sk-help-command)
|
|
95
95
|
* [`sk login [APP]`](#sk-login-app)
|
|
96
96
|
* [`sk onboarding CUSTOMERPATH`](#sk-onboarding-customerpath)
|
|
97
97
|
* [`sk param-diff PAGEURL`](#sk-param-diff-pageurl)
|
|
@@ -309,16 +309,16 @@ EXAMPLES
|
|
|
309
309
|
$ sk generate-pop-config --coverage 95 --pop-limit 6 --traffic-share 2 --deploy appName
|
|
310
310
|
```
|
|
311
311
|
|
|
312
|
-
## `sk help [
|
|
312
|
+
## `sk help [COMMAND]`
|
|
313
313
|
|
|
314
314
|
Display help for sk.
|
|
315
315
|
|
|
316
316
|
```
|
|
317
317
|
USAGE
|
|
318
|
-
$ sk help [
|
|
318
|
+
$ sk help [COMMAND] [-n]
|
|
319
319
|
|
|
320
320
|
ARGUMENTS
|
|
321
|
-
|
|
321
|
+
COMMAND Command to show help for.
|
|
322
322
|
|
|
323
323
|
FLAGS
|
|
324
324
|
-n, --nested-commands Include all nested commands in the output.
|
|
@@ -327,7 +327,7 @@ DESCRIPTION
|
|
|
327
327
|
Display help for sk.
|
|
328
328
|
```
|
|
329
329
|
|
|
330
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.
|
|
330
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.0.18/src/commands/help.ts)_
|
|
331
331
|
|
|
332
332
|
## `sk login [APP]`
|
|
333
333
|
|
|
@@ -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:
|
|
68
|
+
timeout: 10_000,
|
|
69
69
|
});
|
|
70
70
|
const servedBy = resp.headers.get('x-served-by');
|
|
71
71
|
if (resp.status !== 200 || !servedBy) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Command } from
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class GenerateCustomerConfig extends Command {
|
|
3
3
|
static description: string;
|
|
4
|
+
static examples: string[];
|
|
4
5
|
static flags: {
|
|
5
6
|
app: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
7
|
customersDir: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
8
|
};
|
|
8
|
-
static examples: string[];
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
}
|
|
@@ -4,23 +4,23 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const cli_parameters_1 = require("../models/cli-parameters");
|
|
5
5
|
const customer_config_1 = require("../services/customer-config");
|
|
6
6
|
class GenerateCustomerConfig extends core_1.Command {
|
|
7
|
-
static description =
|
|
7
|
+
static description = "Generates a customer config guided by a wizard 🧙";
|
|
8
|
+
static examples = [
|
|
9
|
+
`$ sk generate-customer-config -${cli_parameters_1.CLIParametersChar.AppName} <${cli_parameters_1.CLIParameters.AppName}> -${cli_parameters_1.CLIParametersChar.CustomersDir} <${cli_parameters_1.CLIParameters.CustomersDir}>`,
|
|
10
|
+
`$ sk generate-customer-config -${cli_parameters_1.CLIParametersChar.AppName} ${cli_parameters_1.CLIParametersExample.AppName} -${cli_parameters_1.CLIParametersChar.CustomersDir} ${cli_parameters_1.CLIParametersExample.CustomersDir}`,
|
|
11
|
+
];
|
|
8
12
|
static flags = {
|
|
9
13
|
[cli_parameters_1.CLIParameters.AppName]: core_1.Flags.string({
|
|
10
|
-
description: `The SK app name which is also being used the config output directory name (kebab-case)`,
|
|
11
14
|
char: cli_parameters_1.CLIParametersChar.AppName,
|
|
15
|
+
description: "The SK app name which is also being used the config output directory name (kebab-case)",
|
|
12
16
|
}),
|
|
13
17
|
[cli_parameters_1.CLIParameters.CustomersDir]: core_1.Flags.string({
|
|
18
|
+
char: cli_parameters_1.CLIParametersChar.CustomersDir,
|
|
14
19
|
description: `Name of the sk-onboarding directory where all customer configs are being stored (default: "${cli_parameters_1.CLIParametersExample.CustomersDir}")`,
|
|
15
|
-
char: cli_parameters_1.CLIParametersChar.CustomersDir
|
|
16
20
|
}),
|
|
17
21
|
};
|
|
18
|
-
static examples = [
|
|
19
|
-
`$ sk generate-customer-config -${cli_parameters_1.CLIParametersChar.AppName} <${cli_parameters_1.CLIParameters.AppName}> -${cli_parameters_1.CLIParametersChar.CustomersDir} <${cli_parameters_1.CLIParameters.CustomersDir}>`,
|
|
20
|
-
`$ sk generate-customer-config -${cli_parameters_1.CLIParametersChar.AppName} ${cli_parameters_1.CLIParametersExample.AppName} -${cli_parameters_1.CLIParametersChar.CustomersDir} ${cli_parameters_1.CLIParametersExample.CustomersDir}`,
|
|
21
|
-
];
|
|
22
22
|
async run() {
|
|
23
|
-
const { flags: { app, customersDir } } = await this.parse(GenerateCustomerConfig);
|
|
23
|
+
const { flags: { app, customersDir }, } = await this.parse(GenerateCustomerConfig);
|
|
24
24
|
const context = new customer_config_1.CustomerConfigServiceContext(app, customersDir);
|
|
25
25
|
const customerConfigService = await new customer_config_1.CustomerConfigServiceFactory(context).buildService();
|
|
26
26
|
await customerConfigService.generateConfig();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command } from
|
|
1
|
+
import { Command } from "@oclif/core";
|
|
2
2
|
export default class GeneratePopConfig extends Command {
|
|
3
3
|
static args: {
|
|
4
4
|
app: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
@@ -8,9 +8,9 @@ export default class GeneratePopConfig extends Command {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
coverage: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
deploy: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
"pop-limit": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
+
"traffic-share": import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
|
+
"use-rum": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
14
14
|
};
|
|
15
15
|
createPopPrewarmingCode(popConfig: string): Promise<string>;
|
|
16
16
|
deployPrewarmingConfig(app: string, config: string, deploy: boolean | undefined): Promise<void>;
|
|
@@ -11,54 +11,113 @@ const cli_2 = require("../services/cli");
|
|
|
11
11
|
const config_api_service_1 = tslib_1.__importDefault(require("../services/config-api-service"));
|
|
12
12
|
const diff_service_1 = require("../services/diff-service");
|
|
13
13
|
const POP_REMAPPING = {
|
|
14
|
-
HHN:
|
|
14
|
+
HHN: "FRA",
|
|
15
15
|
};
|
|
16
16
|
const SHIELDS = [
|
|
17
|
-
{ condition: () => true, pop:
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
{ condition: () => true, pop: "FRA", shield: "Default Shield" },
|
|
18
|
+
{
|
|
19
|
+
condition: ({ region }) => region.startsWith("US"),
|
|
20
|
+
pop: "LGA",
|
|
21
|
+
shield: "United States Shield",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
condition: ({ region }) => region.startsWith("SA"),
|
|
25
|
+
pop: "GRU",
|
|
26
|
+
shield: "South America Shield",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
condition: ({ region }) => region.startsWith("APAC"),
|
|
30
|
+
pop: "SYD",
|
|
31
|
+
shield: "APAC Shield",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
condition: ({ pop }) => ["KUL", "QPG"].includes(pop),
|
|
35
|
+
pop: "QPG",
|
|
36
|
+
shield: "Singapore Shield",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
condition: ({ pop }) => ["HKG", "ICN", "MNL"].includes(pop),
|
|
40
|
+
pop: "HKG",
|
|
41
|
+
shield: "Hongkong Shield",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
condition: ({ region }) => region === "Asia-South",
|
|
45
|
+
pop: "DEL",
|
|
46
|
+
shield: "Asia South Shield",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
condition: ({ region }) => region === "North-America",
|
|
50
|
+
pop: "YYZ",
|
|
51
|
+
shield: "North America Shield",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
condition: ({ pop }) => ["DXB", "FJR"].includes(pop),
|
|
55
|
+
pop: "FJR",
|
|
56
|
+
shield: "United Arab Emirates Shield",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
condition: ({ region }) => region === "South-Africa",
|
|
60
|
+
pop: "JNB",
|
|
61
|
+
shield: "South Africa Shield",
|
|
62
|
+
},
|
|
27
63
|
];
|
|
28
|
-
const percentageFormatter = new Intl.NumberFormat(
|
|
64
|
+
const percentageFormatter = new Intl.NumberFormat("en-US", {
|
|
65
|
+
minimumFractionDigits: 1,
|
|
66
|
+
style: "percent",
|
|
67
|
+
});
|
|
29
68
|
class GeneratePopConfig extends core_1.Command {
|
|
30
69
|
static args = {
|
|
31
70
|
[cli_parameters_1.CLIParameters.AppName]: core_1.Args.string({
|
|
32
|
-
description:
|
|
33
|
-
hidden: false,
|
|
34
|
-
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]
|
|
35
74
|
required: true, // make the arg required with `required: true`
|
|
36
75
|
}),
|
|
37
76
|
};
|
|
38
|
-
static description =
|
|
77
|
+
static description = "Generate a pop config for the given app";
|
|
39
78
|
static examples = [
|
|
40
79
|
`$ sk generate-pop-config <${cli_parameters_1.CLIParameters.AppName}>`,
|
|
41
80
|
`$ sk generate-pop-config --use-rum <${cli_parameters_1.CLIParameters.AppName}>`,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
81
|
+
"$ sk generate-pop-config --coverage 95 appName",
|
|
82
|
+
"$ sk generate-pop-config --no-deploy appName",
|
|
83
|
+
"$ sk generate-pop-config --deploy appName",
|
|
84
|
+
"$ sk generate-pop-config --coverage 95 --pop-limit 6 --traffic-share 2 --deploy appName",
|
|
46
85
|
];
|
|
47
86
|
static flags = {
|
|
48
|
-
coverage: core_1.Flags.integer({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
87
|
+
coverage: core_1.Flags.integer({
|
|
88
|
+
char: "c",
|
|
89
|
+
default: 95,
|
|
90
|
+
description: "The percentage of traffic which should be covered through prewarming.",
|
|
91
|
+
}),
|
|
92
|
+
deploy: core_1.Flags.boolean({
|
|
93
|
+
allowNo: true,
|
|
94
|
+
char: "d",
|
|
95
|
+
description: "Default it diffs with the deployed config and ask for deployment. If the flag is passed deployment will be skipped or forced.",
|
|
96
|
+
}),
|
|
97
|
+
"pop-limit": core_1.Flags.integer({
|
|
98
|
+
char: "p",
|
|
99
|
+
default: 5,
|
|
100
|
+
description: "The maximal pop count which should prewarmed.",
|
|
101
|
+
}),
|
|
102
|
+
"traffic-share": core_1.Flags.integer({
|
|
103
|
+
char: "t",
|
|
104
|
+
default: 5,
|
|
105
|
+
description: "The minimum traffic share in percent a pop must have to be actually prewarmed.",
|
|
106
|
+
}),
|
|
107
|
+
"use-rum": core_1.Flags.boolean({
|
|
108
|
+
char: "r",
|
|
109
|
+
default: false,
|
|
110
|
+
description: "Compute the pop statistics based on RUM. Otherwise the real Speed Kit traffic is used.",
|
|
111
|
+
}),
|
|
53
112
|
};
|
|
54
113
|
async createPopPrewarmingCode(popConfig) {
|
|
55
|
-
const revalidationTemplate = await (0, file_helper_1.readLocalFile)(__dirname,
|
|
56
|
-
const pops = await (0, file_helper_1.readLocalFile)(__dirname,
|
|
114
|
+
const revalidationTemplate = await (0, file_helper_1.readLocalFile)(__dirname, "../templates/speedKit.Revalidated.js");
|
|
115
|
+
const pops = await (0, file_helper_1.readLocalFile)(__dirname, "../templates/pops.js");
|
|
57
116
|
popConfig = pops + popConfig;
|
|
58
|
-
return revalidationTemplate.replace(
|
|
117
|
+
return revalidationTemplate.replace("{{config}}", popConfig);
|
|
59
118
|
}
|
|
60
119
|
async deployPrewarmingConfig(app, config, deploy) {
|
|
61
|
-
const moduleName =
|
|
120
|
+
const moduleName = "speedKit.Revalidated";
|
|
62
121
|
const db = await cli_1.account.login({ app });
|
|
63
122
|
const configService = new config_api_service_1.default(db, app);
|
|
64
123
|
const cliService = new cli_2.CliServiceFactory().getService();
|
|
@@ -66,19 +125,21 @@ class GeneratePopConfig extends core_1.Command {
|
|
|
66
125
|
const popPrewarmingCode = await this.createPopPrewarmingCode(config);
|
|
67
126
|
const popPrewarmingCodePath = await diffService.writeContentToTemporalFile(`generated_${moduleName}`, popPrewarmingCode);
|
|
68
127
|
const remoteConfig = await configService.getRemoteModule(moduleName);
|
|
69
|
-
const doDeploy = deploy ??
|
|
128
|
+
const doDeploy = deploy ??
|
|
129
|
+
(await diffService.shouldDeployModule(moduleName, remoteConfig, popPrewarmingCodePath));
|
|
70
130
|
if (doDeploy) {
|
|
71
|
-
const content = await (0, promises_1.readFile)(popPrewarmingCodePath, {
|
|
131
|
+
const content = await (0, promises_1.readFile)(popPrewarmingCodePath, {
|
|
132
|
+
encoding: "utf8",
|
|
133
|
+
});
|
|
72
134
|
await configService.saveRemoteModule(content, moduleName);
|
|
73
135
|
this.log(`Changes for module ${moduleName} were updated successfully`);
|
|
74
136
|
}
|
|
75
137
|
}
|
|
76
138
|
async run() {
|
|
77
|
-
const { args: { app }, flags: { coverage, deploy,
|
|
139
|
+
const { args: { app }, flags: { coverage, deploy, "pop-limit": popLimit, "traffic-share": minimalShare, "use-rum": useRum, }, } = await this.parse(GeneratePopConfig);
|
|
78
140
|
const athenaService = new athena_service_1.AthenaService();
|
|
79
141
|
const result = await athenaService.getUsedPopsPerOrigin(app, useRum);
|
|
80
|
-
const originStats = this.generateOriginStats(result)
|
|
81
|
-
.filter(stats => stats.hits > 1000);
|
|
142
|
+
const originStats = this.generateOriginStats(result).filter((stats) => stats.hits > 1000);
|
|
82
143
|
this.printStats(originStats, coverage / 100, minimalShare / 100, popLimit);
|
|
83
144
|
const popConfig = this.generatePopConfig(originStats, coverage / 100, minimalShare / 100, popLimit);
|
|
84
145
|
await this.deployPrewarmingConfig(app, popConfig, deploy);
|
|
@@ -89,9 +150,13 @@ class GeneratePopConfig extends core_1.Command {
|
|
|
89
150
|
computeCoverageAndShare(totalHits, segmentedStats) {
|
|
90
151
|
segmentedStats = segmentedStats.sort(this.byHitsDesc);
|
|
91
152
|
let segmentHits = 0;
|
|
92
|
-
return segmentedStats.map(segment => {
|
|
153
|
+
return segmentedStats.map((segment) => {
|
|
93
154
|
segmentHits += segment.hits;
|
|
94
|
-
return {
|
|
155
|
+
return {
|
|
156
|
+
...segment,
|
|
157
|
+
coverage: segmentHits / totalHits,
|
|
158
|
+
share: segment.hits / totalHits,
|
|
159
|
+
};
|
|
95
160
|
});
|
|
96
161
|
}
|
|
97
162
|
generateOriginStats(result) {
|
|
@@ -99,38 +164,51 @@ class GeneratePopConfig extends core_1.Command {
|
|
|
99
164
|
for (let { hits, origin, pop, region } of result) {
|
|
100
165
|
pop = POP_REMAPPING[pop] ?? pop;
|
|
101
166
|
const shieldInfo = this.getShieldInfo(region, pop);
|
|
102
|
-
|
|
167
|
+
// eslint-disable-next-line no-multi-assign
|
|
168
|
+
const stats = (originStats[origin] = originStats[origin] ?? {
|
|
103
169
|
hits: 0,
|
|
104
170
|
origin,
|
|
105
171
|
pops: {},
|
|
106
172
|
regions: {},
|
|
107
173
|
shields: {},
|
|
108
|
-
};
|
|
174
|
+
});
|
|
109
175
|
stats.hits += hits;
|
|
110
|
-
|
|
176
|
+
// eslint-disable-next-line no-multi-assign
|
|
177
|
+
const regionStats = (stats.regions[region] = stats.regions[region] ?? {
|
|
178
|
+
hits: 0,
|
|
179
|
+
region,
|
|
180
|
+
});
|
|
111
181
|
regionStats.hits += hits;
|
|
112
|
-
|
|
182
|
+
// eslint-disable-next-line no-multi-assign
|
|
183
|
+
const shieldStats = (stats.shields[shieldInfo.shield] = stats.shields[shieldInfo.shield] ?? { ...shieldInfo, hits: 0 });
|
|
113
184
|
shieldStats.hits += hits;
|
|
114
|
-
|
|
185
|
+
// eslint-disable-next-line no-multi-assign
|
|
186
|
+
const popStats = (stats.pops[pop] = stats.pops[pop] ?? {
|
|
187
|
+
hits: 0,
|
|
188
|
+
pop,
|
|
189
|
+
region,
|
|
190
|
+
shield: shieldInfo.pop,
|
|
191
|
+
});
|
|
115
192
|
popStats.hits += hits;
|
|
116
193
|
}
|
|
117
|
-
return Object.values(originStats)
|
|
194
|
+
return Object.values(originStats)
|
|
195
|
+
.map((stats) => ({
|
|
118
196
|
hits: stats.hits,
|
|
119
197
|
origin: stats.origin,
|
|
120
198
|
pops: this.computeCoverageAndShare(stats.hits, Object.values(stats.pops)),
|
|
121
199
|
regions: this.computeCoverageAndShare(stats.hits, Object.values(stats.regions)),
|
|
122
200
|
shields: this.computeCoverageAndShare(stats.hits, Object.values(stats.shields)),
|
|
123
|
-
}))
|
|
201
|
+
}))
|
|
202
|
+
.sort(this.byHitsDesc);
|
|
124
203
|
}
|
|
125
204
|
generatePopConfig(originStats, coverage, minimalShare, popLimit) {
|
|
126
205
|
const originConfigs = { DEFAULT: [] };
|
|
127
206
|
for (const originStat of originStats) {
|
|
128
|
-
originConfigs[originStat.origin] = this.generatePrewarmingConfig(originStat, coverage, minimalShare, popLimit).pops
|
|
129
|
-
.map(pop => 'POP.' + pop);
|
|
207
|
+
originConfigs[originStat.origin] = this.generatePrewarmingConfig(originStat, coverage, minimalShare, popLimit).pops.map((pop) => "POP." + pop);
|
|
130
208
|
}
|
|
131
|
-
const serializedConfig = JSON.stringify(originConfigs, null,
|
|
132
|
-
.replaceAll(/"(POP.*?)"/g,
|
|
133
|
-
.replaceAll(/\[(.*?)]/gs, match => match.replaceAll(/\s+/gs,
|
|
209
|
+
const serializedConfig = JSON.stringify(originConfigs, null, " ")
|
|
210
|
+
.replaceAll(/"(POP.*?)"/g, "$1")
|
|
211
|
+
.replaceAll(/\[(.*?)]/gs, (match) => match.replaceAll(/\s+/gs, " "));
|
|
134
212
|
return `/* global POP */
|
|
135
213
|
/** @type PopConfig */
|
|
136
214
|
const ORIGIN_POPS = ${serializedConfig}`;
|
|
@@ -152,12 +230,17 @@ const ORIGIN_POPS = ${serializedConfig}`;
|
|
|
152
230
|
let shieldCoverage = 0;
|
|
153
231
|
for (const shieldStats of originStat.shields) {
|
|
154
232
|
// if we are pre warming the shield through an edge pop we increase the edge coverage of the edge and the shield pop
|
|
155
|
-
const shieldPop = originStat.pops.find(pop => pop.pop === shieldStats.pop);
|
|
233
|
+
const shieldPop = originStat.pops.find((pop) => pop.pop === shieldStats.pop);
|
|
156
234
|
edgeCoverage += shieldPop?.share ?? 0; // in the case the shield pop does not receive any direct traffic
|
|
157
235
|
shieldCoverage += shieldStats.share;
|
|
158
236
|
let { pop } = shieldStats;
|
|
159
237
|
// We try to use the top edge pop of the shield, if that pop still has enough traffic
|
|
160
|
-
const bestEdgePopOfShield = originStat.pops.find(popStats =>
|
|
238
|
+
const bestEdgePopOfShield = originStat.pops.find((popStats) =>
|
|
239
|
+
// eslint-disable-next-line eqeqeq
|
|
240
|
+
popStats.shield == pop &&
|
|
241
|
+
// eslint-disable-next-line eqeqeq
|
|
242
|
+
popStats.pop != pop &&
|
|
243
|
+
popStats.share > minimalShare);
|
|
161
244
|
if (bestEdgePopOfShield) {
|
|
162
245
|
edgeCoverage += bestEdgePopOfShield.share;
|
|
163
246
|
pop = bestEdgePopOfShield.pop;
|
|
@@ -167,8 +250,11 @@ const ORIGIN_POPS = ${serializedConfig}`;
|
|
|
167
250
|
break;
|
|
168
251
|
}
|
|
169
252
|
for (const pop of originStat.pops) {
|
|
170
|
-
if (pops.length < popLimit // when the shield pre warming list is short, we can add additional big traffic pops
|
|
171
|
-
|
|
253
|
+
if (pops.length < popLimit && // when the shield pre warming list is short, we can add additional big traffic pops
|
|
254
|
+
pop.share > minimalShare &&
|
|
255
|
+
!pops.includes(pop.pop) &&
|
|
256
|
+
// eslint-disable-next-line eqeqeq
|
|
257
|
+
pop.shield != pop.pop) {
|
|
172
258
|
pops.push(pop.pop);
|
|
173
259
|
edgeCoverage += pop.share;
|
|
174
260
|
}
|
|
@@ -196,35 +282,39 @@ const ORIGIN_POPS = ${serializedConfig}`;
|
|
|
196
282
|
let shieldingRequired = false;
|
|
197
283
|
for (const originStat of originStats) {
|
|
198
284
|
this.log(`${originStat.origin} ${originStat.hits}`);
|
|
199
|
-
this.log(
|
|
285
|
+
this.log(" Regions:");
|
|
200
286
|
for (const regionStats of originStat.regions) {
|
|
201
287
|
this.log(` ${regionStats.region} ${regionStats.hits} ${percentageFormatter.format(regionStats.coverage)}`);
|
|
202
|
-
if (regionStats.coverage >= coverage ||
|
|
288
|
+
if (regionStats.coverage >= coverage ||
|
|
289
|
+
regionStats.share < minimalShare)
|
|
203
290
|
break;
|
|
204
291
|
}
|
|
205
|
-
this.log(
|
|
292
|
+
this.log(" Shields:");
|
|
206
293
|
for (const shieldStats of originStat.shields) {
|
|
207
294
|
this.log(` ${shieldStats.shield} (${shieldStats.pop}) ${shieldStats.hits} ${percentageFormatter.format(shieldStats.coverage)}`);
|
|
208
|
-
if (shieldStats.coverage >= coverage ||
|
|
295
|
+
if (shieldStats.coverage >= coverage ||
|
|
296
|
+
shieldStats.share < minimalShare)
|
|
209
297
|
break;
|
|
210
298
|
}
|
|
211
|
-
this.log(
|
|
299
|
+
this.log(" Pops:");
|
|
212
300
|
for (const popStats of originStat.pops) {
|
|
213
301
|
this.log(` ${popStats.pop} ${popStats.hits} ${percentageFormatter.format(popStats.coverage)} - shield: ${popStats.shield}`);
|
|
214
302
|
if (popStats.coverage >= coverage || popStats.share < minimalShare)
|
|
215
303
|
break;
|
|
216
304
|
}
|
|
217
305
|
const config = this.generatePrewarmingConfig(originStat, coverage, minimalShare, popLimit);
|
|
218
|
-
this.log(
|
|
306
|
+
this.log(" --------------------");
|
|
219
307
|
if (config.requiresShielding)
|
|
220
|
-
this.log(
|
|
221
|
-
|
|
222
|
-
this.log(
|
|
223
|
-
|
|
308
|
+
this.log(" Final shield coverage: " +
|
|
309
|
+
percentageFormatter.format(config.shieldCoverage));
|
|
310
|
+
this.log(" Final edge coverage: " +
|
|
311
|
+
percentageFormatter.format(config.edgeCoverage));
|
|
312
|
+
this.log(" Final pop list: " + config.pops.join(", "));
|
|
313
|
+
this.log("");
|
|
224
314
|
shieldingRequired ||= config.requiresShielding;
|
|
225
315
|
}
|
|
226
316
|
if (shieldingRequired) {
|
|
227
|
-
this.warn(
|
|
317
|
+
this.warn("The prewarming configuration needs enabled shielding to work properly!");
|
|
228
318
|
}
|
|
229
319
|
}
|
|
230
320
|
}
|
package/dist/commands/login.js
CHANGED
|
@@ -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
|
};
|
package/dist/commands/prewarm.js
CHANGED
|
@@ -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
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Require the assert module from Chai
|
|
4
|
+
const { expect } = require('chai');
|
|
5
|
+
// Dummy function to test
|
|
6
|
+
function add(a, b) {
|
|
7
|
+
return a + b;
|
|
8
|
+
}
|
|
9
|
+
// Describe your test suite
|
|
10
|
+
describe('(dummy) add function test', () => {
|
|
11
|
+
// It block describes a single test
|
|
12
|
+
it('should add two numbers', () => {
|
|
13
|
+
// Call our function with some test inputs
|
|
14
|
+
const result = add(2, 3);
|
|
15
|
+
// Assert that our function returned the correct value
|
|
16
|
+
expect(result).to.equal(5);
|
|
17
|
+
});
|
|
18
|
+
// Add more tests here
|
|
19
|
+
});
|
|
@@ -75,8 +75,8 @@ exports.CLI_CONFIG_NAME = {
|
|
|
75
75
|
};
|
|
76
76
|
exports.CLI_CUSTOMER_CONFIG = {
|
|
77
77
|
[CLIParameters.CustomerPath]: core_1.Args.directory({
|
|
78
|
-
name: CLIParameters.CustomerPath,
|
|
79
|
-
required: true,
|
|
78
|
+
name: CLIParameters.CustomerPath, // name of arg to show in help and reference with args[name]
|
|
79
|
+
required: true, // make the arg required with `required: true`
|
|
80
80
|
description: 'The customer config path', // help description
|
|
81
81
|
}),
|
|
82
82
|
};
|
|
@@ -6,10 +6,10 @@ export declare class CliService implements CliServiceInterface {
|
|
|
6
6
|
style: chalk.Chalk & chalk.ChalkFunction & {
|
|
7
7
|
supportsColor: false | chalk.ColorSupport;
|
|
8
8
|
Level: chalk.Level;
|
|
9
|
-
Color: ("
|
|
10
|
-
ForegroundColor: "
|
|
11
|
-
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "
|
|
12
|
-
Modifiers: "hidden" | "bold" | "
|
|
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
|
+
ForegroundColor: "white" | "black" | "blue" | "yellow" | "green" | "red" | "magenta" | "cyan" | "gray" | "blackBright" | "redBright" | "greenBright" | "yellowBright" | "blueBright" | "magentaBright" | "cyanBright" | "whiteBright" | "grey";
|
|
11
|
+
BackgroundColor: "bgBlack" | "bgRed" | "bgGreen" | "bgYellow" | "bgBlue" | "bgMagenta" | "bgCyan" | "bgWhite" | "bgGray" | "bgBlackBright" | "bgRedBright" | "bgGreenBright" | "bgYellowBright" | "bgBlueBright" | "bgMagentaBright" | "bgCyanBright" | "bgWhiteBright" | "bgGrey";
|
|
12
|
+
Modifiers: "hidden" | "bold" | "underline" | "dim" | "italic" | "strikethrough" | "visible" | "reset" | "inverse";
|
|
13
13
|
stderr: chalk.Chalk & {
|
|
14
14
|
supportsColor: false | chalk.ColorSupport;
|
|
15
15
|
};
|
|
@@ -5,7 +5,7 @@ const https_1 = require("https");
|
|
|
5
5
|
const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
|
|
6
6
|
const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
|
|
7
7
|
const race_1 = require("../../helpers/race");
|
|
8
|
-
const REQUEST_TIMEOUT =
|
|
8
|
+
const REQUEST_TIMEOUT = 10_000;
|
|
9
9
|
const CONTENT_TYPE = 'application/json;charset=UTF-8';
|
|
10
10
|
class Client {
|
|
11
11
|
entityManagerFactory;
|
|
@@ -34,7 +34,7 @@ class CustomerConfigHandler extends file_handler_1.default {
|
|
|
34
34
|
throw new customer_config_error_1.default('please specify env TEST_APP in your .env or configFile file');
|
|
35
35
|
}
|
|
36
36
|
const customerConfigContext = {
|
|
37
|
-
module: { exports: {} },
|
|
37
|
+
module: { exports: {} }, // make TEST_APP available for vm
|
|
38
38
|
process: {
|
|
39
39
|
env: { TEST_APP: this.testApp } // make TEST_APP available for vm
|
|
40
40
|
}
|
|
@@ -18,7 +18,7 @@ class CustomerConfigFile extends file_1.default {
|
|
|
18
18
|
}
|
|
19
19
|
updateConfigByContent() {
|
|
20
20
|
const customerConfigContext = {
|
|
21
|
-
module: { exports: {} },
|
|
21
|
+
module: { exports: {} }, // make TEST_APP available for vm
|
|
22
22
|
process: {
|
|
23
23
|
env: { TEST_APP: process.env.TEST_APP } // make TEST_APP available for vm
|
|
24
24
|
}
|
|
@@ -42,7 +42,7 @@ class OnboardingService {
|
|
|
42
42
|
const browser = await puppeteer_extra_1.default.launch({
|
|
43
43
|
devtools: true,
|
|
44
44
|
defaultViewport: null,
|
|
45
|
-
headless: false,
|
|
45
|
+
headless: false, /* ignoreDefaultArgs: true, */
|
|
46
46
|
executablePath: this.browserContext.chromePath,
|
|
47
47
|
args: this.browserContext.browserArgs,
|
|
48
48
|
});
|
|
@@ -23,7 +23,7 @@ class PrewarmService {
|
|
|
23
23
|
authorization: `BAT ${token}`,
|
|
24
24
|
'Accept-Encoding': 'gzip, deflate, br',
|
|
25
25
|
},
|
|
26
|
-
timeout:
|
|
26
|
+
timeout: 10_000,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
// eslint-disable-next-line max-params
|
|
@@ -41,7 +41,7 @@ class PrewarmService {
|
|
|
41
41
|
authorization: `BAT ${token}`,
|
|
42
42
|
'Accept-Encoding': 'gzip, deflate, br',
|
|
43
43
|
},
|
|
44
|
-
timeout:
|
|
44
|
+
timeout: 10_000,
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
static chunk(arr, len) {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@speedkit/cli",
|
|
3
3
|
"description": "Speed Kit CLI",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.10.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Baqend.com",
|
|
7
7
|
"email": "info@baqend.com"
|
|
@@ -15,16 +15,14 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"prepare": "husky install",
|
|
18
|
-
"lint": "eslint --ext .ts,.vue --ignore-path .gitignore src",
|
|
19
|
-
"lint-fix": "eslint --fix --ext .ts,.vue --ignore-path .gitignore src",
|
|
20
18
|
"prebuild": "shx rm -rf dist",
|
|
21
|
-
"build": "tsc -b && copyfiles -u 1 src/**/*hbs ./dist && copyfiles -u 1 src/**/*js ./dist && npm run build
|
|
22
|
-
"build
|
|
19
|
+
"build": "tsc -b && copyfiles -u 1 src/**/*hbs ./dist && copyfiles -u 1 src/**/*js ./dist && npm run build:dashboard",
|
|
20
|
+
"build:dashboard": "copyfiles -u 1 src/services/onboarding/dashboard/frontend-dist/**/*.html dist && copyfiles -u 1 src/services/onboarding/dashboard/frontend-dist/**/*.js dist && copyfiles -u 1 src/services/onboarding/dashboard/frontend-dist/**/*.css dist",
|
|
23
21
|
"postbuild": "oclif manifest && oclif readme",
|
|
24
22
|
"prepack": "npm run build",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"coverage": "nyc --
|
|
23
|
+
"test": "mocha --reporter mocha-junit-reporter --reporter-options mochaFile=junit.xml",
|
|
24
|
+
"coverage": "nyc mocha",
|
|
25
|
+
"coverage:report": "nyc --reporter cobertura mocha"
|
|
28
26
|
},
|
|
29
27
|
"bin": {
|
|
30
28
|
"sk": "bin/run",
|
|
@@ -37,10 +35,9 @@
|
|
|
37
35
|
"oclif"
|
|
38
36
|
],
|
|
39
37
|
"files": [
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"/oclif.manifest.json"
|
|
38
|
+
"dist",
|
|
39
|
+
"oclif.manifest.json",
|
|
40
|
+
"CHANGELOG.md"
|
|
44
41
|
],
|
|
45
42
|
"oclif": {
|
|
46
43
|
"commands": "./dist/commands",
|
|
@@ -62,14 +59,14 @@
|
|
|
62
59
|
"types": "dist/index.d.ts",
|
|
63
60
|
"type": "commonjs",
|
|
64
61
|
"dependencies": {
|
|
65
|
-
"@aws-sdk/client-athena": "^3.
|
|
62
|
+
"@aws-sdk/client-athena": "^3.529",
|
|
66
63
|
"@inquirer/prompts": "^3.0",
|
|
67
|
-
"@oclif/core": "^3.
|
|
64
|
+
"@oclif/core": "^3.23",
|
|
68
65
|
"@oclif/plugin-autocomplete": "^3.0",
|
|
69
66
|
"@oclif/plugin-help": "^6.0",
|
|
70
67
|
"@oclif/plugin-not-found": "^3.0",
|
|
71
68
|
"@oclif/plugin-warn-if-update-available": "^3.0",
|
|
72
|
-
"axios": "^1.
|
|
69
|
+
"axios": "^1.6",
|
|
73
70
|
"baqend": "^3.4",
|
|
74
71
|
"chalk": "^4",
|
|
75
72
|
"clipboardy-cjs": "^3.0.0",
|
|
@@ -78,54 +75,63 @@
|
|
|
78
75
|
"diff": "^5.1.0",
|
|
79
76
|
"dom-serializer": "2.0.0",
|
|
80
77
|
"domhandler": "5.0.3",
|
|
81
|
-
"domutils": "3.
|
|
82
|
-
"dotenv": "^16.
|
|
78
|
+
"domutils": "^3.1",
|
|
79
|
+
"dotenv": "^16.4",
|
|
83
80
|
"extract-zip": "^2.0.1",
|
|
84
81
|
"fs-extra": "^10.1.0",
|
|
85
82
|
"handlebars": "^4.7",
|
|
86
83
|
"htmlparser2": "8.0",
|
|
87
84
|
"json2csv": "^6.0.0-alpha.2",
|
|
88
|
-
"nock": "^13.3.8",
|
|
89
85
|
"node-fetch": "^2.6",
|
|
90
86
|
"parse5": "7.1",
|
|
91
87
|
"parse5-htmlparser2-tree-adapter": "7.0.0",
|
|
92
|
-
"puppeteer": "^21.
|
|
93
|
-
"puppeteer-core": "^
|
|
88
|
+
"puppeteer": "^21.11",
|
|
89
|
+
"puppeteer-core": "^22.4",
|
|
94
90
|
"puppeteer-extra": "^3.3",
|
|
95
91
|
"puppeteer-extra-plugin-user-preferences": "^2.4",
|
|
96
92
|
"strip-comments": "^2.0.1",
|
|
97
|
-
"ts-sinon": "^2.0.2",
|
|
98
93
|
"uuid": "^8.3.2"
|
|
99
94
|
},
|
|
100
95
|
"devDependencies": {
|
|
101
96
|
"@commitlint/cli": "^17.7.1",
|
|
102
97
|
"@commitlint/config-conventional": "^17.7.0",
|
|
98
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
103
99
|
"@oclif/prettier-config": "^0.2.1",
|
|
104
100
|
"@oclif/test": "^3",
|
|
105
101
|
"@types/chai": "^4.3.10",
|
|
106
102
|
"@types/fs-extra": "^9.0.13",
|
|
107
|
-
"@types/mocha": "^10.0
|
|
103
|
+
"@types/mocha": "^10.0",
|
|
108
104
|
"@types/mock-fs": "^4.13.4",
|
|
109
|
-
"@types/node": "^18.
|
|
105
|
+
"@types/node": "^18.19",
|
|
110
106
|
"@types/uuid": "^8.3.4",
|
|
111
|
-
"chai": "^4.
|
|
107
|
+
"chai": "^4.4",
|
|
112
108
|
"copyfiles": "^2.4.1",
|
|
113
|
-
"esbuild": "^0.
|
|
114
|
-
"eslint": "^8.
|
|
115
|
-
"eslint-config-oclif": "^5.
|
|
116
|
-
"eslint-config-oclif-typescript": "^3.
|
|
117
|
-
"eslint-config-prettier": "^9.
|
|
109
|
+
"esbuild": "^0.20",
|
|
110
|
+
"eslint": "^8.57",
|
|
111
|
+
"eslint-config-oclif": "^5.1",
|
|
112
|
+
"eslint-config-oclif-typescript": "^3.1",
|
|
113
|
+
"eslint-config-prettier": "^9.1",
|
|
114
|
+
"eslint-plugin-prettier": "^5.1",
|
|
118
115
|
"globby": "^11",
|
|
119
116
|
"husky": "^8.0.3",
|
|
117
|
+
"lint-staged": "^14.0.1",
|
|
120
118
|
"mocha": "^10.1.0",
|
|
119
|
+
"mocha-junit-reporter": "^2.2.1",
|
|
120
|
+
"nock": "^13.5",
|
|
121
|
+
"ts-sinon": "^2.0.2",
|
|
121
122
|
"mock-fs": "^5.2.0",
|
|
122
123
|
"nyc": "^15.1.0",
|
|
123
|
-
"oclif": "^4.
|
|
124
|
+
"oclif": "^4.5",
|
|
124
125
|
"shx": "^0.3.4",
|
|
125
126
|
"ts-mocha": "^10.0.0",
|
|
126
|
-
"ts-node": "^10.9
|
|
127
|
-
"tslib": "^2.
|
|
128
|
-
"typescript": "^5.
|
|
127
|
+
"ts-node": "^10.9",
|
|
128
|
+
"tslib": "^2.6",
|
|
129
|
+
"typescript": "^5.4",
|
|
129
130
|
"typescript-json-serializer": "^4.3.0"
|
|
131
|
+
},
|
|
132
|
+
"lint-staged": {
|
|
133
|
+
"*.ts": [
|
|
134
|
+
"eslint --fix"
|
|
135
|
+
]
|
|
130
136
|
}
|
|
131
137
|
}
|
package/bin/dev.cmd
DELETED
package/bin/run.cmd
DELETED