@speedkit/cli 2.94.0 → 3.0.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 +34 -0
- package/README.md +10 -7
- package/dist/commands/build-parameter-query.d.ts +0 -1
- package/dist/commands/build-parameter-query.js +9 -76
- package/dist/commands/build-prewarm-query.d.ts +0 -1
- package/dist/commands/build-prewarm-query.js +9 -48
- package/dist/commands/deploy.d.ts +3 -6
- package/dist/commands/deploy.js +3 -17
- package/dist/commands/onboarding.js +2 -2
- package/dist/helpers/array-helper.d.ts +1 -0
- package/dist/helpers/array-helper.js +9 -0
- package/dist/helpers/customer-config.d.ts +0 -1
- package/dist/helpers/customer-config.js +0 -2
- package/dist/models/cli-parameters.d.ts +7 -2
- package/dist/models/cli-parameters.js +12 -1
- package/dist/services/customer-config/customer-config-service-model.d.ts +0 -1
- package/dist/services/customer-config/customer-config-service.js +2 -8
- package/dist/services/customer-config/templates/config_customer.json.hbs +56 -0
- package/dist/services/deploy/context/deploy-context.d.ts +4 -2
- package/dist/services/deploy/context/deploy-context.js +28 -3
- package/dist/services/deploy/deploy-service-factory.js +2 -6
- package/dist/services/deploy/handler/customer-config-handler.d.ts +0 -1
- package/dist/services/deploy/handler/customer-config-handler.js +3 -8
- package/dist/services/deploy/handler/install-resource-handler.js +2 -2
- package/dist/services/deploy/handler/module-handler.js +2 -2
- package/dist/services/deploy/handler/server-config-handler.js +2 -2
- package/dist/services/diff/diff-service.d.ts +1 -1
- package/dist/services/diff/diff-service.js +1 -1
- package/dist/services/integration-api/error/invalid-config-format-error.d.ts +4 -0
- package/dist/services/integration-api/error/invalid-config-format-error.js +15 -0
- package/dist/services/integration-api/file-reader.d.ts +1 -0
- package/dist/services/integration-api/file-reader.js +4 -0
- package/dist/services/integration-api/handler/customer-config-handler.d.ts +2 -1
- package/dist/services/integration-api/handler/customer-config-handler.js +42 -25
- package/dist/services/integration-api/integration-api-factory.js +3 -3
- package/dist/services/integration-api/integration-api-model.d.ts +4 -2
- package/dist/services/integration-api/integration-api-model.js +6 -4
- package/dist/services/integration-api/spec/customer-config-validator.spec.js +1 -1
- package/dist/services/integration-api/spec/file-list.spec.js +2 -2
- package/dist/services/integration-api/spec/file-reader.spec.js +17 -3
- package/dist/services/integration-api/spec/integration-api-service.spec.js +15 -1
- package/dist/services/integration-api/struct/customer-config-file.d.ts +1 -0
- package/dist/services/integration-api/struct/customer-config-file.js +24 -12
- package/dist/services/integration-api/struct/customer-config.d.ts +5 -1
- package/dist/services/integration-api/validator/customer-config-validator.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +2 -1
- package/dist/services/onboarding/onboarding-model.js +4 -1
- package/dist/services/onboarding/onboarding-service-factory.js +1 -1
- package/dist/services/onboarding/templates/install-speed-kit-html-template.js +5 -2
- package/dist/services/pull/pull-service.d.ts +1 -0
- package/dist/services/pull/pull-service.js +13 -0
- package/dist/services/query-builder/error/parse-config-speed-kit-error.d.ts +4 -0
- package/dist/services/query-builder/error/parse-config-speed-kit-error.js +11 -0
- package/dist/services/query-builder/query/parameter.d.ts +4 -0
- package/dist/services/query-builder/query/parameter.js +49 -0
- package/dist/services/query-builder/query/prewarm.d.ts +4 -0
- package/dist/services/query-builder/query/prewarm.js +23 -0
- package/dist/services/query-builder/query-builder-factory.d.ts +11 -0
- package/dist/services/query-builder/query-builder-factory.js +48 -0
- package/dist/services/query-builder/query-builder-model.d.ts +20 -0
- package/dist/services/query-builder/query-builder-model.js +8 -0
- package/dist/services/query-builder/query-builder-service.d.ts +10 -0
- package/dist/services/query-builder/query-builder-service.js +48 -0
- package/oclif.manifest.json +36 -16
- package/package.json +1 -1
- package/dist/services/customer-config/templates/config_customer.js.hbs +0 -62
- package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.d.ts +0 -9
- package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.js +0 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
# [3.0.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.95.0...v3.0.0) (2025-08-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **onboarding:** ignoreFoldersPattern ([bf9f574](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/bf9f574b980ae9f0920f928bc646e1b0e30d14ca))
|
|
7
|
+
* **tests:** integrationApi ([5afc4ec](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/5afc4ece8bd3912ac57573afa7cc900208575924))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* **config-customer:** template ([0b799d6](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/0b799d65f79fa29858bbee3219815d787678b760))
|
|
13
|
+
* **config-wizzard:** reformat config_customer to json ([c98f1a6](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/c98f1a6c06aa5fb639f4600d401a976517a385b2))
|
|
14
|
+
* **customer-config:** config-customer ([21464cc](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/21464cc772bc40e6f567c4a6ffbc046517ba249b))
|
|
15
|
+
* **customer-config:** config-customer ([fdbd030](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/fdbd030877d74543df41a73f7d92e52d9bc1afab))
|
|
16
|
+
* **customerJson:** implement flag -t for deploy|onboarding ([4284a89](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/4284a891d387291a90f1b2deba923cb1004610ec))
|
|
17
|
+
* **customersJson:** check for depricated js format ([0375c0c](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/0375c0cc5d96b71647e0bb62fbfdc82072f4a19c))
|
|
18
|
+
* **integration-api:** config-customer ([d88e1e5](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d88e1e5582cc161beca1a05a93f1b1838130909d))
|
|
19
|
+
* **integration-api:** config-customer ([d88d147](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d88d1470a1b42cb04ab114260181c124f7681895))
|
|
20
|
+
* **integration-api:** update to use json instead of vm ([fd48c0e](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/fd48c0e705870c678900599639c254b92424e981))
|
|
21
|
+
* **pull:** pull originChanges to config ([b922d00](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/b922d009fa56b1b94824fadf925ec255a0974586))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### BREAKING CHANGES
|
|
25
|
+
|
|
26
|
+
* **customer-config:** handle customer config as json for deploy command
|
|
27
|
+
|
|
28
|
+
# [2.95.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.94.0...v2.95.0) (2025-08-07)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* **onboarding:** html install template ([c4caf34](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/c4caf34539ae018c04748902d9d4adffde2589e5))
|
|
34
|
+
|
|
1
35
|
# [2.94.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.93.0...v2.94.0) (2025-07-29)
|
|
2
36
|
|
|
3
37
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
|
|
|
21
21
|
$ sk COMMAND
|
|
22
22
|
running command...
|
|
23
23
|
$ sk (--version)
|
|
24
|
-
@speedkit/cli/
|
|
24
|
+
@speedkit/cli/3.0.0 linux-x64 node-v20.19.4
|
|
25
25
|
$ sk --help [COMMAND]
|
|
26
26
|
USAGE
|
|
27
27
|
$ sk COMMAND
|
|
@@ -181,16 +181,18 @@ Deploys the specified customer config while comparing to the live version before
|
|
|
181
181
|
|
|
182
182
|
```
|
|
183
183
|
USAGE
|
|
184
|
-
$ sk deploy CUSTOMERPATH [-c <value>] [-
|
|
184
|
+
$ sk deploy CUSTOMERPATH [-c <value>] [-t] [-d <value>] [-l] [-v] [-s]
|
|
185
185
|
|
|
186
186
|
ARGUMENTS
|
|
187
187
|
CUSTOMERPATH The customer config path
|
|
188
188
|
|
|
189
189
|
FLAGS
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
190
|
+
-c, --configName=<value> [default: production] The costumer config name
|
|
191
|
+
-d, --domain=<value> Startup domain (optional)
|
|
192
|
+
-l, --local Run with local documentHandler
|
|
193
|
+
-s, --ignoreContentSecurityPolicy Removes header/meta "content-security-policy" for origin-responses
|
|
194
|
+
-t, --useTestConfig Override app with configured testApp
|
|
195
|
+
-v, --verboseLevel Show all messages
|
|
194
196
|
|
|
195
197
|
DESCRIPTION
|
|
196
198
|
Deploys the specified customer config while comparing to the live version before
|
|
@@ -381,7 +383,7 @@ Start a local dev environment for building and testing the Speed Kit configurati
|
|
|
381
383
|
|
|
382
384
|
```
|
|
383
385
|
USAGE
|
|
384
|
-
$ sk onboarding CUSTOMERPATH [-c <value>] [-d <value>] [-l] [-v] [-s]
|
|
386
|
+
$ sk onboarding CUSTOMERPATH [-c <value>] [-t] [-d <value>] [-l] [-v] [-s]
|
|
385
387
|
|
|
386
388
|
ARGUMENTS
|
|
387
389
|
CUSTOMERPATH The customer config path
|
|
@@ -391,6 +393,7 @@ FLAGS
|
|
|
391
393
|
-d, --domain=<value> Startup domain (optional)
|
|
392
394
|
-l, --local Run with local documentHandler
|
|
393
395
|
-s, --ignoreContentSecurityPolicy Removes header/meta "content-security-policy" for origin-responses
|
|
396
|
+
-t, --useTestConfig Override app with configured testApp
|
|
394
397
|
-v, --verboseLevel Show all messages
|
|
395
398
|
|
|
396
399
|
DESCRIPTION
|
|
@@ -10,6 +10,5 @@ export default class BuildParameterQuery extends Command {
|
|
|
10
10
|
static flags: {
|
|
11
11
|
configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
|
-
buildParameterQuery(app: string, parameterFilter: string, whitelistedFilter: string, blacklistedFilter: string, parameterReplaceFilter: string): string;
|
|
14
13
|
run(): Promise<void>;
|
|
15
14
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
-
const clipboardy_cjs_1 = tslib_1.__importDefault(require("clipboardy-cjs"));
|
|
7
|
-
const customer_config_1 = require("../helpers/customer-config");
|
|
8
|
-
const build_query_helper_1 = require("../helpers/build-query-helper");
|
|
9
|
-
const get_parsed_config_1 = require("../helpers/get-parsed-config");
|
|
10
|
-
const logging_helper_1 = require("../helpers/logging-helper");
|
|
11
4
|
const cli_parameters_1 = require("../models/cli-parameters");
|
|
5
|
+
const query_builder_factory_1 = require("../services/query-builder/query-builder-factory");
|
|
6
|
+
const cli_config_1 = require("../helpers/cli-config");
|
|
7
|
+
const query_builder_model_1 = require("../services/query-builder/query-builder-model");
|
|
12
8
|
class BuildParameterQuery extends core_1.Command {
|
|
13
9
|
static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
|
|
14
10
|
static description = "Build a parameter query that can be executed in Athena";
|
|
@@ -19,77 +15,14 @@ class BuildParameterQuery extends core_1.Command {
|
|
|
19
15
|
static flags = {
|
|
20
16
|
...cli_parameters_1.CLI_CONFIG_NAME,
|
|
21
17
|
};
|
|
22
|
-
buildParameterQuery(app, parameterFilter, whitelistedFilter, blacklistedFilter, parameterReplaceFilter) {
|
|
23
|
-
const nowMinusOneMonth = new Date(new Date().setMonth(new Date().getMonth() - 1, new Date().getDate()));
|
|
24
|
-
const monthString = `${nowMinusOneMonth.getMonth() + 1 < 10 ? "0" : ""}${nowMinusOneMonth.getMonth() + 1}`;
|
|
25
|
-
const dateString = `${nowMinusOneMonth.getDate() < 10 ? "0" : ""}${nowMinusOneMonth.getDate()}`;
|
|
26
|
-
const date = `${nowMinusOneMonth.getFullYear()}-${monthString}-${dateString}`;
|
|
27
|
-
return `
|
|
28
|
-
with urlWithParams as (
|
|
29
|
-
select
|
|
30
|
-
url,
|
|
31
|
-
createdat,
|
|
32
|
-
split(url, '?')[1] as urlWithoutParams,
|
|
33
|
-
filter (
|
|
34
|
-
transform(
|
|
35
|
-
split(split(url, '?')[2], '&'),
|
|
36
|
-
(pair) -> split(pair, '=')[1]
|
|
37
|
-
),
|
|
38
|
-
(key) -> ${parameterFilter}
|
|
39
|
-
) as paramKeys
|
|
40
|
-
from live.rum.pi
|
|
41
|
-
where app = '${app}'
|
|
42
|
-
and date >= '${date}'
|
|
43
|
-
and cardinality(split(url, '?')) > 1
|
|
44
|
-
and (${whitelistedFilter})
|
|
45
|
-
and ${blacklistedFilter}
|
|
46
|
-
), prepared as (
|
|
47
|
-
select count(*) as PIs,
|
|
48
|
-
count(distinct url) as urls,
|
|
49
|
-
count(distinct ${parameterReplaceFilter}) as cachedUrls,
|
|
50
|
-
count(distinct urlWithoutParams) as uniqueWithoutParam,
|
|
51
|
-
paramKeys,
|
|
52
|
-
element_at(array_distinct(max_by(url, MD5(to_utf8(to_iso8601(createdat))), 500)), 1) as example1,
|
|
53
|
-
element_at(array_distinct(max_by(url, MD5(to_utf8(to_iso8601(createdat))), 500)), 2) as example2,
|
|
54
|
-
element_at(array_distinct(max_by(url, MD5(to_utf8(to_iso8601(createdat))), 500)), 3) as example3
|
|
55
|
-
from urlWithParams
|
|
56
|
-
group by paramKeys
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
select paramKeys, cachedUrls - uniqueWithoutParam as potentialGain, cachedUrls, PIs, example1, example2, example3
|
|
60
|
-
from prepared
|
|
61
|
-
where cardinality(paramKeys) > 0
|
|
62
|
-
order by potentialGain desc, cachedUrls desc, PIs desc`;
|
|
63
|
-
}
|
|
64
18
|
async run() {
|
|
65
19
|
const { args: { customerPath }, flags: { configName }, } = await this.parse(BuildParameterQuery);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const parameterFilter = (0, build_query_helper_1.getParameterFilter)(parameters, skConfigVersion);
|
|
73
|
-
const parameterReplaceFilter = (0, build_query_helper_1.getParameterReplaceFilter)(parameters, 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("");
|
|
20
|
+
const service = await new query_builder_factory_1.QueryBuilderFactory({
|
|
21
|
+
configName,
|
|
22
|
+
customerPath,
|
|
23
|
+
isWindows: this.config.windows,
|
|
24
|
+
}, new cli_config_1.CliConfig(this.config).load()).buildService(query_builder_model_1.QueryTpe.parameter);
|
|
25
|
+
await service.run();
|
|
93
26
|
}
|
|
94
27
|
}
|
|
95
28
|
exports.default = BuildParameterQuery;
|
|
@@ -10,6 +10,5 @@ export default class BuildPrewarmQuery extends Command {
|
|
|
10
10
|
static flags: {
|
|
11
11
|
configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
12
|
};
|
|
13
|
-
buildPrewarmQuery(app: string, whitelistedFilter: string, blacklistedFilter: string, parameterReplaceFilter: string): string;
|
|
14
13
|
run(): Promise<void>;
|
|
15
14
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const core_1 = require("@oclif/core");
|
|
5
|
-
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
-
const clipboardy_cjs_1 = tslib_1.__importDefault(require("clipboardy-cjs"));
|
|
7
|
-
const customer_config_1 = require("../helpers/customer-config");
|
|
8
|
-
const build_query_helper_1 = require("../helpers/build-query-helper");
|
|
9
|
-
const get_parsed_config_1 = require("../helpers/get-parsed-config");
|
|
10
|
-
const logging_helper_1 = require("../helpers/logging-helper");
|
|
11
4
|
const cli_parameters_1 = require("../models/cli-parameters");
|
|
5
|
+
const cli_config_1 = require("../helpers/cli-config");
|
|
6
|
+
const query_builder_factory_1 = require("../services/query-builder/query-builder-factory");
|
|
7
|
+
const query_builder_model_1 = require("../services/query-builder/query-builder-model");
|
|
12
8
|
class BuildPrewarmQuery extends core_1.Command {
|
|
13
9
|
static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
|
|
14
10
|
static description = "Build a prewarm query that can be executed in Athena";
|
|
@@ -19,49 +15,14 @@ class BuildPrewarmQuery extends core_1.Command {
|
|
|
19
15
|
static flags = {
|
|
20
16
|
...cli_parameters_1.CLI_CONFIG_NAME,
|
|
21
17
|
};
|
|
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
|
-
from live.rum.pi
|
|
31
|
-
where app = '${app}'
|
|
32
|
-
and date >= '${date}'
|
|
33
|
-
and ${whitelistedFilter}
|
|
34
|
-
and ${blacklistedFilter})
|
|
35
|
-
group by url
|
|
36
|
-
order by count(*) desc`;
|
|
37
|
-
}
|
|
38
18
|
async run() {
|
|
39
19
|
const { args: { customerPath }, flags: { configName }, } = await this.parse(BuildPrewarmQuery);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const whitelistedFilter = (0, build_query_helper_1.getWhitelistedFilter)(parsedConfig);
|
|
47
|
-
const blacklistedFilter = (0, build_query_helper_1.getBlacklistedFilter)(parsedConfig);
|
|
48
|
-
const result = this.buildPrewarmQuery(app || parsedConfig.appName, whitelistedFilter, blacklistedFilter, parameterReplaceFilter);
|
|
49
|
-
if (!this.config.windows) {
|
|
50
|
-
clipboardy_cjs_1.default.writeSync(result);
|
|
51
|
-
}
|
|
52
|
-
console.log(chalk_1.default.dim.italic(result));
|
|
53
|
-
console.log("");
|
|
54
|
-
core_1.ux.action.stop();
|
|
55
|
-
console.log("");
|
|
56
|
-
if (!this.config.windows) {
|
|
57
|
-
(0, logging_helper_1.logInfo)("Result has been copied to the clipboard 📋");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
console.log("");
|
|
62
|
-
(0, logging_helper_1.logError)(error.stack);
|
|
63
|
-
}
|
|
64
|
-
console.log("");
|
|
20
|
+
const service = await new query_builder_factory_1.QueryBuilderFactory({
|
|
21
|
+
configName,
|
|
22
|
+
customerPath,
|
|
23
|
+
isWindows: this.config.windows,
|
|
24
|
+
}, new cli_config_1.CliConfig(this.config).load()).buildService(query_builder_model_1.QueryTpe.prewarm);
|
|
25
|
+
await service.run();
|
|
65
26
|
}
|
|
66
27
|
}
|
|
67
28
|
exports.default = BuildPrewarmQuery;
|
|
@@ -5,13 +5,10 @@ export default class Deploy extends Command {
|
|
|
5
5
|
exists?: boolean | undefined;
|
|
6
6
|
}>;
|
|
7
7
|
};
|
|
8
|
+
static flags: import("@oclif/core/lib/interfaces/parser").FlagInput<{
|
|
9
|
+
[flag: string]: any;
|
|
10
|
+
}>;
|
|
8
11
|
static description: string;
|
|
9
12
|
static examples: string[];
|
|
10
|
-
static flags: {
|
|
11
|
-
artifacts: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
|
-
dryRun: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
slackToken: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
14
|
-
configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
15
|
-
};
|
|
16
13
|
run(): Promise<void>;
|
|
17
14
|
}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -8,29 +8,15 @@ const deploy_context_1 = tslib_1.__importDefault(require("../services/deploy/con
|
|
|
8
8
|
const deploy_service_factory_1 = tslib_1.__importDefault(require("../services/deploy/deploy-service-factory"));
|
|
9
9
|
class Deploy extends core_1.Command {
|
|
10
10
|
static args = cli_parameters_1.CLI_CUSTOMER_CONFIG;
|
|
11
|
+
static flags = deploy_context_1.default.flags;
|
|
11
12
|
static description = "Deploys the specified customer config while comparing to the live version before";
|
|
12
13
|
static examples = [
|
|
13
14
|
`$ 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
15
|
`$ 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
16
|
];
|
|
16
|
-
static flags = {
|
|
17
|
-
...cli_parameters_1.CLI_CONFIG_NAME,
|
|
18
|
-
[cli_parameters_1.CLIParameters.Artifacts]: core_1.Flags.string({
|
|
19
|
-
char: cli_parameters_1.CLIParametersChar.Artifacts,
|
|
20
|
-
description: "Whitelist of files to deploy",
|
|
21
|
-
}),
|
|
22
|
-
[cli_parameters_1.CLIParameters.DryRun]: core_1.Flags.boolean({
|
|
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",
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
17
|
async run() {
|
|
32
|
-
const { args: { customerPath }, flags: { artifacts, configName, dryRun,
|
|
33
|
-
const deployContext = new deploy_context_1.default(customerPath, configName,
|
|
18
|
+
const { args: { customerPath }, flags: { artifacts, configName, dryRun, useTestConfig }, } = await this.parse(Deploy);
|
|
19
|
+
const deployContext = new deploy_context_1.default(customerPath, configName, artifacts, dryRun, useTestConfig);
|
|
34
20
|
const deployService = await new deploy_service_factory_1.default(deployContext, new cli_config_1.CliConfig(this.config).load()).buildService();
|
|
35
21
|
await deployService.run();
|
|
36
22
|
}
|
|
@@ -13,8 +13,8 @@ class Onboarding extends core_1.Command {
|
|
|
13
13
|
`$ sk onboarding ${cli_parameters_1.CLIParametersExample.CustomerPath} -${cli_parameters_1.CLIParametersChar.ConfigName} ${cli_parameters_1.CLIParametersExample.ConfigName} -${cli_parameters_1.CLIParametersChar.Domain} ${cli_parameters_1.CLIParametersExample.Domain}`,
|
|
14
14
|
];
|
|
15
15
|
async run() {
|
|
16
|
-
const { args: { customerPath }, flags: { configName, domain, local, verboseLevel, ignoreContentSecurityPolicy, }, } = await this.parse(Onboarding);
|
|
17
|
-
const service = await new onboarding_1.OnboardingServiceFactory(new onboarding_1.OnboardingContext(customerPath, configName, domain, local, ignoreContentSecurityPolicy, this.config.root, verboseLevel), new cli_config_1.CliConfig(this.config).load()).getService();
|
|
16
|
+
const { args: { customerPath }, flags: { configName, domain, local, verboseLevel, ignoreContentSecurityPolicy, useTestConfig, }, } = await this.parse(Onboarding);
|
|
17
|
+
const service = await new onboarding_1.OnboardingServiceFactory(new onboarding_1.OnboardingContext(customerPath, configName, domain, local, ignoreContentSecurityPolicy, this.config.root, verboseLevel, useTestConfig), new cli_config_1.CliConfig(this.config).load()).getService();
|
|
18
18
|
await service.run();
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isSame(array1: string[], array2: string[]): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isSame = isSame;
|
|
4
|
+
// Check if two arrays are the same, regardless of order
|
|
5
|
+
function isSame(array1, array2) {
|
|
6
|
+
return (array1.length === array2.length &&
|
|
7
|
+
array1.every((value) => array2.includes(value)) &&
|
|
8
|
+
array2.every((value) => array1.includes(value)));
|
|
9
|
+
}
|
|
@@ -24,7 +24,6 @@ export declare class CustomerConfig implements InstallConfigs<ConfigFile | null>
|
|
|
24
24
|
readonly installPath: string;
|
|
25
25
|
readonly installParams?: string;
|
|
26
26
|
readonly forceInstall: boolean;
|
|
27
|
-
readonly bypassDeactivation: boolean;
|
|
28
27
|
readonly scope: string;
|
|
29
28
|
readonly swPath: string;
|
|
30
29
|
readonly origins?: string[];
|
|
@@ -60,7 +60,6 @@ class CustomerConfig {
|
|
|
60
60
|
installPath;
|
|
61
61
|
installParams;
|
|
62
62
|
forceInstall;
|
|
63
|
-
bypassDeactivation;
|
|
64
63
|
scope;
|
|
65
64
|
swPath;
|
|
66
65
|
origins;
|
|
@@ -111,7 +110,6 @@ class CustomerConfig {
|
|
|
111
110
|
this.origins = optional(Array.isArray, parameters, "origins", []);
|
|
112
111
|
this.installParams = optional(isString, parameters, "installParams", 'async crossorigin="anonymous"');
|
|
113
112
|
this.forceInstall = optional(isBoolean, parameters, "forceInstall", false);
|
|
114
|
-
this.bypassDeactivation = optional(isBoolean, parameters, "bypassDeactivation", true);
|
|
115
113
|
// Assign Config Files
|
|
116
114
|
Object.assign(this, configFiles);
|
|
117
115
|
}
|
|
@@ -22,7 +22,8 @@ export declare enum CLIParameters {
|
|
|
22
22
|
TestId = "testId",
|
|
23
23
|
Urls = "urls",
|
|
24
24
|
Variation = "variation",
|
|
25
|
-
VariationPath = "variationPath"
|
|
25
|
+
VariationPath = "variationPath",
|
|
26
|
+
useTestConfig = "useTestConfig"
|
|
26
27
|
}
|
|
27
28
|
export declare enum CLIParametersChar {
|
|
28
29
|
AppName = "a",
|
|
@@ -45,7 +46,8 @@ export declare enum CLIParametersChar {
|
|
|
45
46
|
Path = "p",
|
|
46
47
|
Variation = "v",
|
|
47
48
|
VariationPath = "p",
|
|
48
|
-
Quiet = "q"
|
|
49
|
+
Quiet = "q",
|
|
50
|
+
useTestConfig = "t"
|
|
49
51
|
}
|
|
50
52
|
export declare enum CLIParametersExample {
|
|
51
53
|
AppName = "decathlon",
|
|
@@ -72,6 +74,9 @@ export declare enum CLIParametersExample {
|
|
|
72
74
|
export declare const CLI_CONFIG_NAME: {
|
|
73
75
|
configName: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
74
76
|
};
|
|
77
|
+
export declare const CLI_CONFIG_IS_TEST: {
|
|
78
|
+
useTestConfig: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
79
|
+
};
|
|
75
80
|
export declare const CLI_CUSTOMER_CONFIG: {
|
|
76
81
|
customerPath: import("@oclif/core/lib/interfaces").Arg<string, {
|
|
77
82
|
exists?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLI_CUSTOMER_CONFIG = exports.CLI_CONFIG_NAME = exports.CLIParametersExample = exports.CLIParametersChar = exports.CLIParameters = void 0;
|
|
3
|
+
exports.CLI_CUSTOMER_CONFIG = exports.CLI_CONFIG_IS_TEST = exports.CLI_CONFIG_NAME = exports.CLIParametersExample = exports.CLIParametersChar = exports.CLIParameters = void 0;
|
|
4
4
|
const core_1 = require("@oclif/core");
|
|
5
5
|
var CLIParameters;
|
|
6
6
|
(function (CLIParameters) {
|
|
@@ -28,6 +28,7 @@ var CLIParameters;
|
|
|
28
28
|
CLIParameters["Urls"] = "urls";
|
|
29
29
|
CLIParameters["Variation"] = "variation";
|
|
30
30
|
CLIParameters["VariationPath"] = "variationPath";
|
|
31
|
+
CLIParameters["useTestConfig"] = "useTestConfig";
|
|
31
32
|
})(CLIParameters || (exports.CLIParameters = CLIParameters = {}));
|
|
32
33
|
/* eslint-disable @typescript-eslint/no-duplicate-enum-values */
|
|
33
34
|
var CLIParametersChar;
|
|
@@ -53,6 +54,7 @@ var CLIParametersChar;
|
|
|
53
54
|
CLIParametersChar["Variation"] = "v";
|
|
54
55
|
CLIParametersChar["VariationPath"] = "p";
|
|
55
56
|
CLIParametersChar["Quiet"] = "q";
|
|
57
|
+
CLIParametersChar["useTestConfig"] = "t";
|
|
56
58
|
})(CLIParametersChar || (exports.CLIParametersChar = CLIParametersChar = {}));
|
|
57
59
|
/* eslint-enable @typescript-eslint/no-duplicate-enum-values */
|
|
58
60
|
var CLIParametersExample;
|
|
@@ -86,6 +88,15 @@ exports.CLI_CONFIG_NAME = {
|
|
|
86
88
|
required: false,
|
|
87
89
|
}),
|
|
88
90
|
};
|
|
91
|
+
// to enable testMode for deploy and onboarding command
|
|
92
|
+
// it will set the field app to the configured testApp
|
|
93
|
+
// and name to the original configured app
|
|
94
|
+
exports.CLI_CONFIG_IS_TEST = {
|
|
95
|
+
[CLIParameters.useTestConfig]: core_1.Flags.boolean({
|
|
96
|
+
char: CLIParametersChar.useTestConfig,
|
|
97
|
+
description: "Override app with configured testApp",
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
89
100
|
exports.CLI_CUSTOMER_CONFIG = {
|
|
90
101
|
[CLIParameters.CustomerPath]: core_1.Args.directory({
|
|
91
102
|
name: CLIParameters.CustomerPath,
|
|
@@ -26,7 +26,7 @@ class CustomerConfigService {
|
|
|
26
26
|
return this._outputDirPath;
|
|
27
27
|
}
|
|
28
28
|
templates = [
|
|
29
|
-
"config_customer.
|
|
29
|
+
"config_customer.json.hbs",
|
|
30
30
|
"config_documentHandler.js.hbs",
|
|
31
31
|
"config_dynamicBlocks.es6.hbs",
|
|
32
32
|
"config_dynamicStyles.css.hbs",
|
|
@@ -136,7 +136,7 @@ class CustomerConfigService {
|
|
|
136
136
|
return true;
|
|
137
137
|
}
|
|
138
138
|
async getConfigSettings() {
|
|
139
|
-
let { production, staging, activateScopedDeployments, subRouteScope, includeServiceWorker, activateImageOptimisation, removeLazyLoading, addPreRendering, supportShadowDomInPreRendering, shadowDomCustomElementPrefix, activateRumTracking, useGATracking, useScrapingBee, withGoogleOptimize, activateCfRocketLoaderWorkaround, hasSoftNavigations, isShopify, isShopware, isSalesforce, isOxid, isPlentymarkets,
|
|
139
|
+
let { production, staging, activateScopedDeployments, subRouteScope, includeServiceWorker, activateImageOptimisation, removeLazyLoading, addPreRendering, supportShadowDomInPreRendering, shadowDomCustomElementPrefix, activateRumTracking, useGATracking, useScrapingBee, withGoogleOptimize, activateCfRocketLoaderWorkaround, hasSoftNavigations, isShopify, isShopware, isSalesforce, isOxid, isPlentymarkets, } = {};
|
|
140
140
|
this.appName = await this.cli.prompt(`[App Name] Enter desired SK app name:`, {
|
|
141
141
|
validator: (input) => /^[\da-z]+(?:-[\da-z]+)*$/.test(input) ? "" : "No valid kebab-case",
|
|
142
142
|
defaultAnswer: this.appName,
|
|
@@ -166,11 +166,6 @@ class CustomerConfigService {
|
|
|
166
166
|
isPlentymarkets = true;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
if (isShopify) {
|
|
170
|
-
shopifyId = await this.cli.prompt(`[Shop System] Enter the shop's Shopify ID:`, {
|
|
171
|
-
defaultAnswer: this.appName,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
169
|
production = await this.getEnvironmentConfig(customer_config_service_model_1.EnvironmentType.PRODUCTION, `www.${this.appName}.de`);
|
|
175
170
|
if (!isShopify) {
|
|
176
171
|
const withStaging = await this.cli.confirm(`[${customer_config_service_model_1.EnvironmentType.STAGING.toUpperCase()}] Should a ${customer_config_service_model_1.EnvironmentType.STAGING.toUpperCase()} config also be added?`, false);
|
|
@@ -235,7 +230,6 @@ class CustomerConfigService {
|
|
|
235
230
|
isSalesforce,
|
|
236
231
|
isOxid,
|
|
237
232
|
isPlentymarkets,
|
|
238
|
-
shopifyId,
|
|
239
233
|
};
|
|
240
234
|
}
|
|
241
235
|
async logWarnings(configSettings) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"production": {
|
|
3
|
+
"_meta": {
|
|
4
|
+
"shopSystem":
|
|
5
|
+
{{#if isShopify}}
|
|
6
|
+
"Shopify"
|
|
7
|
+
{{else if isShopware}}
|
|
8
|
+
"Shopware"
|
|
9
|
+
{{else if isSalesforce}}
|
|
10
|
+
"Salesforce Commerce Cloud"
|
|
11
|
+
{{else if isOxid}}
|
|
12
|
+
"OXID eShop"
|
|
13
|
+
{{else if isPlentymarkets}}
|
|
14
|
+
"Plentymarkets"
|
|
15
|
+
{{else}}
|
|
16
|
+
"TODO: enter name of system in use"
|
|
17
|
+
{{/if}},
|
|
18
|
+
},
|
|
19
|
+
"app": "{{appName}}",
|
|
20
|
+
"domain": "{{production.host}}",
|
|
21
|
+
"origins": [
|
|
22
|
+
"https://{{production.host}}"
|
|
23
|
+
],
|
|
24
|
+
{{#if isShopify}}
|
|
25
|
+
"swPath": "/apps/speed-kit/sw.js",
|
|
26
|
+
{{else}}
|
|
27
|
+
"swPath": "/wrapper-sw.js",
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{#if subRouteScope}}
|
|
30
|
+
"scope": "/{{subRouteScope}}/",
|
|
31
|
+
{{else}}
|
|
32
|
+
"scope": "/",
|
|
33
|
+
{{/if}}
|
|
34
|
+
"forceInstall": {{production.forceInstall}}
|
|
35
|
+
}
|
|
36
|
+
{{#if staging.host}},
|
|
37
|
+
"staging": {
|
|
38
|
+
"name": "staging",
|
|
39
|
+
"domain": "{{staging.host}}",
|
|
40
|
+
"origins": [
|
|
41
|
+
"https://{{staging.host}}"
|
|
42
|
+
],
|
|
43
|
+
"forceInstall": {{staging.forceInstall}},
|
|
44
|
+
{{#if isShopify}}
|
|
45
|
+
"swPath": "/apps/speed-kit/sw.js",
|
|
46
|
+
{{else}}
|
|
47
|
+
"swPath": "/wrapper-sw.js",
|
|
48
|
+
{{/if}}
|
|
49
|
+
{{#if subRouteScope}}
|
|
50
|
+
"scope": "/{{subRouteScope}}/"
|
|
51
|
+
{{else}}
|
|
52
|
+
"scope": "/"
|
|
53
|
+
{{/if}}
|
|
54
|
+
}
|
|
55
|
+
{{/if}}
|
|
56
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { FlagInput } from "@oclif/core/lib/interfaces/parser";
|
|
1
2
|
export default class DeployContext {
|
|
2
3
|
readonly customerPath: string;
|
|
3
4
|
readonly configName: string;
|
|
4
|
-
readonly slackToken?: string;
|
|
5
5
|
readonly dryRun: boolean;
|
|
6
|
+
readonly useTestConfig: boolean;
|
|
7
|
+
static flags: FlagInput;
|
|
6
8
|
readonly artifacts?: string[];
|
|
7
9
|
readonly isProduction: boolean;
|
|
8
|
-
constructor(customerPath: string, configName?: string,
|
|
10
|
+
constructor(customerPath: string, configName?: string, artifacts?: string, dryRun?: boolean, useTestConfig?: boolean);
|
|
9
11
|
hasArtifacts(): boolean;
|
|
10
12
|
}
|
|
@@ -2,21 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const dotenv = tslib_1.__importStar(require("dotenv"));
|
|
5
|
+
const cli_parameters_1 = require("../../../models/cli-parameters");
|
|
6
|
+
const core_1 = require("@oclif/core");
|
|
5
7
|
dotenv.config();
|
|
6
8
|
const DEFAULT_CONFIG_NAME = "production";
|
|
7
9
|
const ARTIFACTS_SEPARATOR = ",";
|
|
8
10
|
class DeployContext {
|
|
9
11
|
customerPath;
|
|
10
12
|
configName;
|
|
11
|
-
slackToken;
|
|
12
13
|
dryRun;
|
|
14
|
+
useTestConfig;
|
|
15
|
+
static flags = {
|
|
16
|
+
...cli_parameters_1.CLI_CONFIG_NAME,
|
|
17
|
+
...cli_parameters_1.CLI_CONFIG_IS_TEST,
|
|
18
|
+
[cli_parameters_1.CLIParameters.Domain]: core_1.Flags.string({
|
|
19
|
+
char: cli_parameters_1.CLIParametersChar.Domain,
|
|
20
|
+
description: "Startup domain (optional)",
|
|
21
|
+
}),
|
|
22
|
+
local: core_1.Flags.boolean({
|
|
23
|
+
char: "l",
|
|
24
|
+
default: false,
|
|
25
|
+
description: "Run with local documentHandler",
|
|
26
|
+
}),
|
|
27
|
+
verboseLevel: core_1.Flags.boolean({
|
|
28
|
+
char: "v",
|
|
29
|
+
default: false,
|
|
30
|
+
description: "Show all messages",
|
|
31
|
+
}),
|
|
32
|
+
ignoreContentSecurityPolicy: core_1.Flags.boolean({
|
|
33
|
+
char: "s",
|
|
34
|
+
default: false,
|
|
35
|
+
description: `Removes header/meta "content-security-policy" for origin-responses`,
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
13
38
|
artifacts;
|
|
14
39
|
isProduction;
|
|
15
|
-
constructor(customerPath, configName = DEFAULT_CONFIG_NAME,
|
|
40
|
+
constructor(customerPath, configName = DEFAULT_CONFIG_NAME, artifacts, dryRun = false, useTestConfig = false) {
|
|
16
41
|
this.customerPath = customerPath;
|
|
17
42
|
this.configName = configName;
|
|
18
|
-
this.slackToken = slackToken;
|
|
19
43
|
this.dryRun = dryRun;
|
|
44
|
+
this.useTestConfig = useTestConfig;
|
|
20
45
|
this.artifacts = artifacts ? artifacts.split(ARTIFACTS_SEPARATOR) : [];
|
|
21
46
|
this.isProduction = configName.toLowerCase().includes("prod");
|
|
22
47
|
}
|