@speedkit/cli 4.36.1 → 4.36.2
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 +7 -0
- package/dist/base/sk-command.d.ts +41 -0
- package/dist/base/sk-command.js +56 -0
- package/dist/commands/auto-prewarm.d.ts +6 -4
- package/dist/commands/auto-prewarm.js +13 -66
- package/dist/commands/autocomplete/fish.d.ts +2 -2
- package/dist/commands/autocomplete/fish.js +3 -2
- package/dist/commands/browser/clean.d.ts +2 -2
- package/dist/commands/browser/clean.js +6 -6
- package/dist/commands/browser/list.d.ts +2 -2
- package/dist/commands/browser/list.js +6 -7
- package/dist/commands/browser/update.d.ts +2 -2
- package/dist/commands/browser/update.js +9 -11
- package/dist/commands/bulk-deploy.d.ts +4 -2
- package/dist/commands/bulk-deploy.js +7 -37
- package/dist/commands/config/edit.d.ts +2 -2
- package/dist/commands/config/edit.js +2 -2
- package/dist/commands/config/setup.d.ts +5 -2
- package/dist/commands/config/setup.js +9 -19
- package/dist/commands/deploy.d.ts +12 -3
- package/dist/commands/deploy.js +14 -20
- package/dist/commands/diff-url-parameters.d.ts +3 -2
- package/dist/commands/diff-url-parameters.js +19 -16
- package/dist/commands/extension/add.d.ts +2 -2
- package/dist/commands/extension/add.js +6 -6
- package/dist/commands/extension/devtools.d.ts +2 -2
- package/dist/commands/extension/devtools.js +6 -7
- package/dist/commands/extension/list.d.ts +2 -2
- package/dist/commands/extension/list.js +5 -6
- package/dist/commands/extension/remove.d.ts +2 -2
- package/dist/commands/extension/remove.js +6 -6
- package/dist/commands/extension/update.d.ts +2 -2
- package/dist/commands/extension/update.js +5 -6
- package/dist/commands/find-pops.d.ts +2 -2
- package/dist/commands/find-pops.js +10 -11
- package/dist/commands/generate-customer-config.d.ts +5 -2
- package/dist/commands/generate-customer-config.js +9 -27
- package/dist/commands/generate-pop-config.d.ts +2 -2
- package/dist/commands/generate-pop-config.js +19 -15
- package/dist/commands/login.d.ts +2 -2
- package/dist/commands/login.js +6 -9
- package/dist/commands/onboarding.d.ts +18 -3
- package/dist/commands/onboarding.js +13 -11
- package/dist/commands/origin-request.d.ts +4 -2
- package/dist/commands/origin-request.js +10 -42
- package/dist/commands/prewarm.d.ts +4 -2
- package/dist/commands/prewarm.js +12 -56
- package/dist/commands/pull.d.ts +4 -2
- package/dist/commands/pull.js +9 -14
- package/dist/commands/query/parameter.d.ts +4 -2
- package/dist/commands/query/parameter.js +12 -19
- package/dist/commands/query/prewarm.d.ts +4 -2
- package/dist/commands/query/prewarm.js +16 -23
- package/dist/commands/revalidate.d.ts +4 -2
- package/dist/commands/revalidate.js +13 -56
- package/dist/commands/wpt-launcher.d.ts +2 -2
- package/dist/commands/wpt-launcher.js +16 -17
- package/dist/hooks/init/first-run.js +9 -10
- package/dist/models/context.d.ts +24 -0
- package/dist/models/context.js +31 -0
- package/dist/services/athena/athena-flags.d.ts +18 -0
- package/dist/services/athena/athena-flags.js +29 -0
- package/dist/services/athena/athena-service-build-context.d.ts +25 -0
- package/dist/services/athena/athena-service-build-context.js +4 -0
- package/dist/services/athena/athena-service-factory.d.ts +3 -16
- package/dist/services/athena/athena-service-factory.js +11 -27
- package/dist/services/athena/baqend-athena-service.d.ts +3 -14
- package/dist/services/athena/baqend-athena-service.js +8 -16
- package/dist/services/athena/index.d.ts +1 -0
- package/dist/services/athena/index.js +1 -0
- package/dist/services/athena/spec/baqend-athena-service.spec.js +2 -2
- package/dist/services/browser-fetch/browser-origin-fetch.d.ts +2 -2
- package/dist/services/browser-fetch/browser-origin-fetch.js +1 -1
- package/dist/services/browser-fetch/browser-origin-fetcher.d.ts +3 -3
- package/dist/services/browser-fetch/browser-origin-fetcher.js +5 -5
- package/dist/services/browser-fetch/spec/browser-origin-fetch.spec.js +10 -10
- package/dist/services/cli/cli-environment-factory.d.ts +25 -0
- package/dist/services/cli/cli-environment-factory.js +30 -0
- package/dist/services/cli/cli-environment.d.ts +73 -0
- package/dist/services/cli/cli-environment.js +216 -0
- package/dist/services/cli/cli-service-build-context.d.ts +10 -0
- package/dist/services/cli/cli-service-build-context.js +4 -0
- package/dist/services/cli/cli-service-factory.d.ts +7 -7
- package/dist/services/cli/cli-service-factory.js +7 -7
- package/dist/services/cli/cli-service-model.d.ts +0 -4
- package/dist/services/cli/cli-service-model.js +0 -6
- package/dist/services/cli/cli-service.d.ts +16 -2
- package/dist/services/cli/cli-service.js +17 -18
- package/dist/services/cli/cli-settings.d.ts +37 -0
- package/dist/services/cli/cli-settings.js +23 -0
- package/dist/services/cli/command-build-context.d.ts +23 -0
- package/dist/services/cli/index.d.ts +5 -1
- package/dist/services/cli/index.js +5 -1
- package/dist/services/cli/spec/cli-environment-detection.spec.js +52 -0
- package/dist/services/cli/spec/cli-environment.spec.js +125 -0
- package/dist/services/cli/spec/cli-service.spec.js +9 -19
- package/dist/services/config-api/client.d.ts +3 -3
- package/dist/services/config-api/client.js +4 -4
- package/dist/services/config-api/config-api-factory.js +3 -3
- package/dist/services/config-api/entity-manager-provider.d.ts +11 -0
- package/dist/services/config-api/{entity-manager-factory.js → entity-manager-provider.js} +7 -1
- package/dist/services/customer-config/customer-config-service-build-context.d.ts +33 -0
- package/dist/services/customer-config/customer-config-service-build-context.js +36 -0
- package/dist/services/customer-config/customer-config-service-factory.d.ts +3 -4
- package/dist/services/customer-config/customer-config-service-factory.js +5 -8
- package/dist/services/customer-config/customer-config-service.d.ts +2 -2
- package/dist/services/customer-config/index.d.ts +1 -1
- package/dist/services/customer-config/index.js +1 -1
- package/dist/services/customer-config/site-analyzer/index.d.ts +1 -0
- package/dist/services/customer-config/site-analyzer/index.js +1 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.d.ts +6 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-build-context.js +4 -0
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.d.ts +3 -3
- package/dist/services/customer-config/site-analyzer/site-analyzer-service-factory.js +4 -5
- package/dist/services/deploy/bulk/bulk-deploy-model.d.ts +0 -25
- package/dist/services/deploy/bulk/bulk-deploy-model.js +1 -27
- package/dist/services/deploy/bulk/bulk-deploy-service-build-context.d.ts +51 -0
- package/dist/services/deploy/bulk/bulk-deploy-service-build-context.js +50 -0
- package/dist/services/deploy/bulk/bulk-deploy-service-factory.d.ts +2 -4
- package/dist/services/deploy/bulk/bulk-deploy-service-factory.js +2 -5
- package/dist/services/deploy/bulk/bulk-deploy-service.d.ts +3 -2
- package/dist/services/deploy/bulk/config-deploy-factory.d.ts +3 -3
- package/dist/services/deploy/bulk/config-deploy-factory.js +16 -8
- package/dist/services/deploy/bulk/index.d.ts +1 -0
- package/dist/services/deploy/bulk/index.js +1 -0
- package/dist/services/deploy/checks/activation/customer-approval-check.d.ts +3 -1
- package/dist/services/deploy/checks/activation/customer-approval-check.js +4 -2
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.d.ts +3 -1
- package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +4 -2
- package/dist/services/deploy/checks/pre-deploy/split-change-check.d.ts +3 -1
- package/dist/services/deploy/checks/pre-deploy/split-change-check.js +4 -2
- package/dist/services/deploy/deploy-service-build-context.d.ts +63 -0
- package/dist/services/deploy/deploy-service-build-context.js +64 -0
- package/dist/services/deploy/deploy-service-factory.d.ts +5 -8
- package/dist/services/deploy/deploy-service-factory.js +28 -19
- package/dist/services/deploy/mr/base-config-reader.d.ts +6 -4
- package/dist/services/deploy/mr/base-config-reader.js +6 -8
- package/dist/services/deploy/mr/index.d.ts +1 -0
- package/dist/services/deploy/mr/index.js +1 -0
- package/dist/services/deploy/mr/merge-request-deploy-model.d.ts +0 -35
- package/dist/services/deploy/mr/merge-request-deploy-model.js +0 -34
- package/dist/services/deploy/mr/merge-request-deploy-service-build-context.d.ts +32 -0
- package/dist/services/deploy/mr/merge-request-deploy-service-build-context.js +20 -0
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.d.ts +2 -4
- package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +31 -10
- package/dist/services/deploy/mr/merge-request-deploy-service.d.ts +3 -2
- package/dist/services/deploy/spec/bulk/bulk-deploy-service.spec.js +14 -3
- package/dist/services/deploy/spec/checks/activation/customer-approval-check.spec.js +7 -5
- package/dist/services/deploy/spec/checks/pre-deploy/split-change-check.spec.js +2 -1
- package/dist/services/diff/diff-service-build-context.d.ts +14 -0
- package/dist/services/diff/diff-service-build-context.js +4 -0
- package/dist/services/diff/diff-service-factory.d.ts +4 -5
- package/dist/services/diff/diff-service-factory.js +4 -7
- package/dist/services/diff/index.d.ts +1 -1
- package/dist/services/diff/index.js +1 -1
- package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.d.ts → document-handler-runtime-model.d.ts} +0 -5
- package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.d.ts +11 -0
- package/dist/services/document-handler-runtime/document-handler-runtime-service-build-context.js +4 -0
- package/dist/services/document-handler-runtime/document-handler-server.js +2 -2
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.d.ts +3 -6
- package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +14 -14
- package/dist/services/document-handler-runtime/server/request.js +1 -1
- package/dist/services/document-handler-runtime/templates/database-mock.d.ts +1 -1
- package/dist/services/document-handler-runtime/templates/database-mock.js +1 -1
- package/dist/services/integration-api/customer-config-flags.d.ts +16 -0
- package/dist/services/integration-api/customer-config-flags.js +30 -0
- package/dist/services/integration-api/handler/install-resource-handler.d.ts +8 -0
- package/dist/services/integration-api/handler/install-resource-handler.js +10 -1
- package/dist/services/integration-api/index.d.ts +1 -0
- package/dist/services/integration-api/index.js +1 -0
- package/dist/services/integration-api/integration-api-factory.d.ts +4 -6
- package/dist/services/integration-api/integration-api-factory.js +11 -11
- package/dist/services/integration-api/integration-api-model.d.ts +0 -9
- package/dist/services/integration-api/integration-api-model.js +0 -16
- package/dist/services/integration-api/integration-api-service-build-context.d.ts +19 -0
- package/dist/services/integration-api/integration-api-service-build-context.js +4 -0
- package/dist/services/integration-api/spec/config-plugin.spec.js +1 -1
- package/dist/services/integration-api/spec/integration-api-service.spec.js +7 -3
- package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +9 -2
- package/dist/services/integration-api/struct/config-plugin.d.ts +1 -1
- package/dist/services/integration-api/struct/config-plugin.js +12 -7
- package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +18 -2
- package/dist/services/integration-api/struct/speed-kit-config-file.js +22 -12
- package/dist/services/integration-api/struct/speed-kit-config.d.ts +1 -1
- package/dist/services/onboarding/browser/config/browser-config.d.ts +3 -3
- package/dist/services/onboarding/browser/config/browser-config.js +5 -5
- package/dist/services/onboarding/browser/executable/executable-validator.d.ts +3 -3
- package/dist/services/onboarding/browser/executable/executable-validator.js +17 -15
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +6 -6
- package/dist/services/onboarding/browser/extension/extension-validator.d.ts +3 -3
- package/dist/services/onboarding/browser/extension/extension-validator.js +4 -4
- package/dist/services/onboarding/file-events/file-watcher.js +1 -0
- package/dist/services/onboarding/index.d.ts +1 -1
- package/dist/services/onboarding/index.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +8 -24
- package/dist/services/onboarding/onboarding-model.js +19 -87
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +57 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +67 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +2 -5
- package/dist/services/onboarding/onboarding-service-factory.js +47 -34
- package/dist/services/onboarding/spec/onboarding-model.spec.js +11 -6
- package/dist/services/origin-request/index.d.ts +1 -1
- package/dist/services/origin-request/index.js +1 -1
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +52 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +54 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +2 -5
- package/dist/services/origin-request/origin-request-service-factory.js +12 -12
- package/dist/services/origin-request/origin-request-service.d.ts +2 -2
- package/dist/services/pop-config/index.d.ts +1 -0
- package/dist/services/pop-config/index.js +1 -0
- package/dist/services/pop-config/pop-config-factory.d.ts +4 -1
- package/dist/services/pop-config/pop-config-factory.js +10 -3
- package/dist/services/pop-config/pop-config-service-build-context.d.ts +10 -0
- package/dist/services/pop-config/pop-config-service-build-context.js +4 -0
- package/dist/services/prewarm/auto-pre-warm-factory.d.ts +3 -31
- package/dist/services/prewarm/auto-pre-warm-factory.js +6 -11
- package/dist/services/prewarm/auto-pre-warm-service-build-context.d.ts +84 -0
- package/dist/services/prewarm/auto-pre-warm-service-build-context.js +68 -0
- package/dist/services/prewarm/index.d.ts +2 -0
- package/dist/services/prewarm/index.js +2 -0
- package/dist/services/prewarm/pre-warm-factory.d.ts +4 -5
- package/dist/services/prewarm/pre-warm-factory.js +6 -8
- package/dist/services/prewarm/pre-warm-model.d.ts +0 -10
- package/dist/services/prewarm/pre-warm-model.js +0 -18
- package/dist/services/prewarm/pre-warm-service-build-context.d.ts +47 -0
- package/dist/services/prewarm/pre-warm-service-build-context.js +64 -0
- package/dist/services/pull/index.d.ts +1 -0
- package/dist/services/pull/index.js +1 -0
- package/dist/services/pull/pull-service-build-context.d.ts +28 -0
- package/dist/services/pull/pull-service-build-context.js +17 -0
- package/dist/services/pull/pull-service-factory.d.ts +3 -5
- package/dist/services/pull/pull-service-factory.js +13 -14
- package/dist/services/pull/pull-service-model.d.ts +0 -5
- package/dist/services/pull/pull-service-model.js +0 -9
- package/dist/services/query-builder/query-builder-factory.d.ts +9 -7
- package/dist/services/query-builder/query-builder-factory.js +26 -15
- package/dist/{models/cli-parameters.d.ts → services/query-builder/query-builder-flags.d.ts} +1 -120
- package/dist/services/query-builder/query-builder-flags.js +150 -0
- package/dist/services/query-builder/query-builder-model.d.ts +1 -14
- package/dist/services/query-builder/query-builder-service-build-context.d.ts +113 -0
- package/dist/services/query-builder/query-builder-service-build-context.js +68 -0
- package/dist/services/query-builder/query-builder-service.d.ts +3 -3
- package/dist/services/query-builder/spec/query-builder-flags.spec.d.ts +1 -0
- package/dist/{models/spec/cli-parameters.spec.js → services/query-builder/spec/query-builder-flags.spec.js} +1 -1
- package/dist/services/revalidate/index.d.ts +1 -0
- package/dist/services/revalidate/index.js +1 -0
- package/dist/services/revalidate/revalidate-factory.d.ts +3 -5
- package/dist/services/revalidate/revalidate-factory.js +2 -6
- package/dist/services/revalidate/revalidate-model.d.ts +0 -9
- package/dist/services/revalidate/revalidate-model.js +0 -8
- package/dist/services/revalidate/revalidate-service-build-context.d.ts +38 -0
- package/dist/services/revalidate/revalidate-service-build-context.js +59 -0
- package/dist/services/setup/browser/browser-setup-service.d.ts +3 -4
- package/dist/services/setup/browser/browser-setup-service.js +16 -18
- package/dist/services/setup/difftool/difftool-setup-service.d.ts +3 -4
- package/dist/services/setup/difftool/difftool-setup-service.js +5 -7
- package/dist/services/setup/extension/extension-setup-service.d.ts +3 -4
- package/dist/services/setup/extension/extension-setup-service.js +8 -10
- package/dist/services/setup/index.d.ts +1 -1
- package/dist/services/setup/index.js +1 -1
- package/dist/services/setup/setup-service-build-context.d.ts +27 -0
- package/dist/services/setup/setup-service-build-context.js +26 -0
- package/dist/services/setup/setup-service-factory.d.ts +2 -6
- package/dist/services/setup/setup-service-factory.js +10 -18
- package/dist/services/setup/setup-service.d.ts +4 -5
- package/dist/services/setup/setup-service.js +6 -7
- package/oclif.manifest.json +1 -1
- package/package.json +4 -2
- package/dist/models/cli-parameters.js +0 -297
- package/dist/services/cli/cli-config.d.ts +0 -59
- package/dist/services/cli/cli-config.js +0 -180
- package/dist/services/cli/environment.d.ts +0 -15
- package/dist/services/cli/environment.js +0 -40
- package/dist/services/cli/spec/cli-config.spec.js +0 -117
- package/dist/services/cli/spec/environment.spec.js +0 -28
- package/dist/services/config-api/entity-manager-factory.d.ts +0 -5
- package/dist/services/customer-config/customer-config-service-context.d.ts +0 -13
- package/dist/services/customer-config/customer-config-service-context.js +0 -21
- package/dist/services/deploy/context/deploy-context.d.ts +0 -32
- package/dist/services/deploy/context/deploy-context.js +0 -72
- package/dist/services/diff/diff-model.d.ts +0 -9
- package/dist/services/diff/diff-model.js +0 -12
- package/dist/services/origin-request/origin-request-context.d.ts +0 -13
- package/dist/services/origin-request/origin-request-context.js +0 -23
- package/dist/services/query-builder/query-command.d.ts +0 -28
- package/dist/services/query-builder/query-command.js +0 -37
- package/dist/services/setup/setup-context.d.ts +0 -14
- package/dist/services/setup/setup-context.js +0 -15
- /package/dist/{models/spec/cli-parameters.spec.d.ts → services/cli/command-build-context.js} +0 -0
- /package/dist/services/cli/spec/{cli-config.spec.d.ts → cli-environment-detection.spec.d.ts} +0 -0
- /package/dist/services/cli/spec/{environment.spec.d.ts → cli-environment.spec.d.ts} +0 -0
- /package/dist/services/document-handler-runtime/{context/document-handler-runtime-context.js → document-handler-runtime-model.js} +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, beforeEach, afterEach, it } from "mocha";
|
|
3
|
+
import { mkdtempSync, rmSync, readFileSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { CliEnvironment } from "../cli-environment.js";
|
|
7
|
+
function fakeOclifConfig(dir) {
|
|
8
|
+
return {
|
|
9
|
+
configDir: dir,
|
|
10
|
+
cacheDir: dir,
|
|
11
|
+
home: "/home/tester",
|
|
12
|
+
windows: false,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
describe("CliEnvironment settings save/load", () => {
|
|
16
|
+
let dir;
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
dir = mkdtempSync(path.join(tmpdir(), "sk-cli-environment-"));
|
|
19
|
+
});
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
rmSync(dir, { recursive: true, force: true });
|
|
22
|
+
});
|
|
23
|
+
it("persists and reloads boolean and number settings with their types", () => {
|
|
24
|
+
const cfg = CliEnvironment.load(fakeOclifConfig(dir));
|
|
25
|
+
cfg.save({
|
|
26
|
+
browserAutoUpdate: true,
|
|
27
|
+
updateReminderDays: 7,
|
|
28
|
+
firstRunCompleted: true,
|
|
29
|
+
browserChannel: "stable",
|
|
30
|
+
});
|
|
31
|
+
const reloaded = CliEnvironment.load(fakeOclifConfig(dir));
|
|
32
|
+
expect(reloaded.settings.browserAutoUpdate).to.equal(true);
|
|
33
|
+
expect(reloaded.settings.updateReminderDays).to.equal(7);
|
|
34
|
+
expect(reloaded.settings.firstRunCompleted).to.equal(true);
|
|
35
|
+
expect(reloaded.settings.browserChannel).to.equal("stable");
|
|
36
|
+
});
|
|
37
|
+
it("merges partial saves instead of overwriting the whole file", () => {
|
|
38
|
+
const cfg = CliEnvironment.load(fakeOclifConfig(dir));
|
|
39
|
+
cfg.save({ diffTool: "code", diffExec: "/usr/bin/code" });
|
|
40
|
+
cfg.save({ browserChannel: "experimental" });
|
|
41
|
+
const reloaded = CliEnvironment.load(fakeOclifConfig(dir));
|
|
42
|
+
expect(reloaded.settings.diffTool).to.equal("code");
|
|
43
|
+
expect(reloaded.settings.diffExec).to.equal("/usr/bin/code");
|
|
44
|
+
expect(reloaded.settings.browserChannel).to.equal("experimental");
|
|
45
|
+
});
|
|
46
|
+
it("never writes what the environment derives to config.json", () => {
|
|
47
|
+
const environment = CliEnvironment.load(fakeOclifConfig(dir));
|
|
48
|
+
environment.save({ ...environment.settings, firstRunCompleted: true });
|
|
49
|
+
const raw = JSON.parse(readFileSync(path.join(dir, "config.json"), "utf8"));
|
|
50
|
+
for (const derived of [
|
|
51
|
+
"cacheDir",
|
|
52
|
+
"nodeModulesPath",
|
|
53
|
+
"oclif",
|
|
54
|
+
"runtimeConfig",
|
|
55
|
+
"tempFolder",
|
|
56
|
+
]) {
|
|
57
|
+
expect(raw).to.not.have.property(derived);
|
|
58
|
+
}
|
|
59
|
+
expect(raw.firstRunCompleted).to.equal(true);
|
|
60
|
+
});
|
|
61
|
+
it("reflects a save in the running environment's settings", () => {
|
|
62
|
+
const environment = CliEnvironment.load(fakeOclifConfig(dir));
|
|
63
|
+
environment.save({ browserChannel: "stable" });
|
|
64
|
+
expect(environment.settings.browserChannel).to.equal("stable");
|
|
65
|
+
});
|
|
66
|
+
it("derives the node modules path from the cache dir and the customer", () => {
|
|
67
|
+
const environment = CliEnvironment.load(fakeOclifConfig(dir), "customers/shop");
|
|
68
|
+
expect(environment.cacheDir).to.equal(dir);
|
|
69
|
+
expect(environment.nodeModulesPath).to.equal(path.resolve(dir, "additional_node_modules", "customers/shop"));
|
|
70
|
+
});
|
|
71
|
+
it("keeps defaults for a false boolean stored in the file", () => {
|
|
72
|
+
const cfg = CliEnvironment.load(fakeOclifConfig(dir));
|
|
73
|
+
cfg.save({ browserAutoUpdate: false });
|
|
74
|
+
const reloaded = CliEnvironment.load(fakeOclifConfig(dir));
|
|
75
|
+
expect(reloaded.settings.browserAutoUpdate).to.equal(false);
|
|
76
|
+
});
|
|
77
|
+
it("round-trips the managedChromeExtensions array", () => {
|
|
78
|
+
const cfg = CliEnvironment.load(fakeOclifConfig(dir));
|
|
79
|
+
cfg.save({
|
|
80
|
+
managedChromeExtensions: [
|
|
81
|
+
{ id: "abc", name: "Ext", version: "1.0.0", path: "/tmp/ext/abc" },
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
const reloaded = CliEnvironment.load(fakeOclifConfig(dir));
|
|
85
|
+
expect(reloaded.settings.managedChromeExtensions).to.have.length(1);
|
|
86
|
+
expect(reloaded.settings.managedChromeExtensions[0].id).to.equal("abc");
|
|
87
|
+
expect(reloaded.settings.managedChromeExtensions[0].version).to.equal("1.0.0");
|
|
88
|
+
});
|
|
89
|
+
describe("chromeFlags", () => {
|
|
90
|
+
const previous = process.env.CHROME_FLAGS;
|
|
91
|
+
afterEach(() => {
|
|
92
|
+
if (previous === undefined) {
|
|
93
|
+
delete process.env.CHROME_FLAGS;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
process.env.CHROME_FLAGS = previous;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
it("reads the array from config.json", () => {
|
|
100
|
+
delete process.env.CHROME_FLAGS;
|
|
101
|
+
CliEnvironment.load(fakeOclifConfig(dir)).save({
|
|
102
|
+
chromeFlags: ["--ozone-platform=wayland"],
|
|
103
|
+
});
|
|
104
|
+
const loaded = CliEnvironment.load(fakeOclifConfig(dir));
|
|
105
|
+
expect(loaded.settings.chromeFlags).to.deep.equal([
|
|
106
|
+
"--ozone-platform=wayland",
|
|
107
|
+
]);
|
|
108
|
+
});
|
|
109
|
+
it("lets CHROME_FLAGS replace config.json, parsed into an array", () => {
|
|
110
|
+
CliEnvironment.load(fakeOclifConfig(dir)).save({
|
|
111
|
+
chromeFlags: ["--ozone-platform=wayland"],
|
|
112
|
+
});
|
|
113
|
+
process.env.CHROME_FLAGS = "--enable-features=A,B --mute-audio";
|
|
114
|
+
const loaded = CliEnvironment.load(fakeOclifConfig(dir));
|
|
115
|
+
expect(loaded.settings.chromeFlags).to.deep.equal([
|
|
116
|
+
"--enable-features=A,B",
|
|
117
|
+
"--mute-audio",
|
|
118
|
+
]);
|
|
119
|
+
});
|
|
120
|
+
it("defaults to no flags", () => {
|
|
121
|
+
delete process.env.CHROME_FLAGS;
|
|
122
|
+
expect(CliEnvironment.load(fakeOclifConfig(dir)).settings.chromeFlags).to.deep.equal([]);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
import { afterEach, beforeEach, describe, it } from "mocha";
|
|
3
3
|
import { CliService } from "../cli-service.js";
|
|
4
|
+
import { ClipboardService } from "../clipboard/index.js";
|
|
5
|
+
/** What a CI runner looks like to the CLI: no spinner can spin, nobody to ask. */
|
|
6
|
+
const CI_TERMINAL = { isCI: true, nonInteractive: true };
|
|
4
7
|
/** The lines a block of work put on stdout. */
|
|
5
8
|
function captured(work) {
|
|
6
9
|
const lines = [];
|
|
@@ -15,28 +18,15 @@ function captured(work) {
|
|
|
15
18
|
return lines;
|
|
16
19
|
}
|
|
17
20
|
describe("CliService actions without a terminal", () => {
|
|
18
|
-
let ci;
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
ci = process.env.CI;
|
|
21
|
-
// What a CI runner sets, and what spinnies reads to decide it cannot spin.
|
|
22
|
-
process.env.CI = "true";
|
|
23
|
-
});
|
|
24
|
-
afterEach(() => {
|
|
25
|
-
if (ci === undefined) {
|
|
26
|
-
delete process.env.CI;
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
process.env.CI = ci;
|
|
30
|
-
});
|
|
31
21
|
it("should say nothing while an action runs", () => {
|
|
32
|
-
const cli = new CliService();
|
|
22
|
+
const cli = new CliService(new ClipboardService(), CI_TERMINAL);
|
|
33
23
|
expect(captured(() => cli.startAction("BUILD", "build prewarm-query"))).to.have.lengthOf(0);
|
|
34
24
|
});
|
|
35
25
|
it("should log an action that ended exactly once", () => {
|
|
36
26
|
// Spinnies re-renders every spinner it knows on each update when it cannot
|
|
37
27
|
// animate, so a running action reappears under each later one — a job with
|
|
38
28
|
// four actions logged "build prewarm-query" four times.
|
|
39
|
-
const cli = new CliService();
|
|
29
|
+
const cli = new CliService(new ClipboardService(), CI_TERMINAL);
|
|
40
30
|
const lines = captured(() => {
|
|
41
31
|
cli.startAction("BUILD", "build prewarm-query");
|
|
42
32
|
cli.successAction("BUILD");
|
|
@@ -49,7 +39,7 @@ describe("CliService actions without a terminal", () => {
|
|
|
49
39
|
expect(lines.join("\n")).to.not.contain("build prewarm-query\n✖ execute athena query\n✔ build prewarm-query");
|
|
50
40
|
});
|
|
51
41
|
it("should keep the text of the action it ends", () => {
|
|
52
|
-
const cli = new CliService();
|
|
42
|
+
const cli = new CliService(new ClipboardService(), CI_TERMINAL);
|
|
53
43
|
const lines = captured(() => {
|
|
54
44
|
cli.startAction("WARM", "warm the list");
|
|
55
45
|
cli.endAction("WARM");
|
|
@@ -57,7 +47,7 @@ describe("CliService actions without a terminal", () => {
|
|
|
57
47
|
expect(lines).to.deep.equal(["- warm the list"]);
|
|
58
48
|
});
|
|
59
49
|
it("should stay silent when it was told to be quiet", () => {
|
|
60
|
-
const cli = new CliService(true);
|
|
50
|
+
const cli = new CliService(new ClipboardService(), CI_TERMINAL, true);
|
|
61
51
|
const lines = captured(() => {
|
|
62
52
|
cli.startAction("BUILD", "build prewarm-query");
|
|
63
53
|
cli.successAction("BUILD");
|
|
@@ -87,7 +77,7 @@ describe("CliService table", () => {
|
|
|
87
77
|
reason: "commits after !8021 change config_documentHandler.js and config_dynamicStyles.css of this customer",
|
|
88
78
|
};
|
|
89
79
|
it("keeps the short columns readable and wraps the long one", () => {
|
|
90
|
-
const lines = captured(() => new CliService().table([row], {
|
|
80
|
+
const lines = captured(() => new CliService(new ClipboardService(), CI_TERMINAL).table([row], {
|
|
91
81
|
customer: {},
|
|
92
82
|
outcome: {},
|
|
93
83
|
reason: {},
|
|
@@ -96,7 +86,7 @@ describe("CliService table", () => {
|
|
|
96
86
|
expect(lines.join("\n")).to.contain("alreadyDeployed");
|
|
97
87
|
});
|
|
98
88
|
it("stays inside the terminal", () => {
|
|
99
|
-
const lines = captured(() => new CliService().table([row], {
|
|
89
|
+
const lines = captured(() => new CliService(new ClipboardService(), CI_TERMINAL).table([row], {
|
|
100
90
|
customer: {},
|
|
101
91
|
outcome: {},
|
|
102
92
|
reason: {},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { EntityManager } from "baqend";
|
|
2
|
-
import {
|
|
2
|
+
import { EntityManagerProvider } from "./entity-manager-provider.js";
|
|
3
3
|
import { RequestExtensionInterface } from "./index.js";
|
|
4
4
|
export declare class Client {
|
|
5
5
|
private readonly agent;
|
|
6
6
|
private readonly app;
|
|
7
|
-
private readonly
|
|
8
|
-
constructor(app: string,
|
|
7
|
+
private readonly entityManagerProvider;
|
|
8
|
+
constructor(app: string, entityManagerProvider: EntityManagerProvider);
|
|
9
9
|
createRequest(requestExtension: RequestExtensionInterface): Promise<RequestInit>;
|
|
10
10
|
getEntityManager(): Promise<EntityManager>;
|
|
11
11
|
getModule(moduleName: string): Promise<string>;
|
|
@@ -12,10 +12,10 @@ const CONTENT_TYPE = "application/json;charset=UTF-8";
|
|
|
12
12
|
export class Client {
|
|
13
13
|
agent;
|
|
14
14
|
app;
|
|
15
|
-
|
|
16
|
-
constructor(app,
|
|
15
|
+
entityManagerProvider;
|
|
16
|
+
constructor(app, entityManagerProvider) {
|
|
17
17
|
this.app = app;
|
|
18
|
-
this.
|
|
18
|
+
this.entityManagerProvider = entityManagerProvider;
|
|
19
19
|
this.agent = new Agent({ keepAlive: true, rejectUnauthorized: false });
|
|
20
20
|
}
|
|
21
21
|
async createRequest(requestExtension) {
|
|
@@ -33,7 +33,7 @@ export class Client {
|
|
|
33
33
|
return { ...deepmerge(baseRequest, requestExtension), agent: this.agent };
|
|
34
34
|
}
|
|
35
35
|
async getEntityManager() {
|
|
36
|
-
const result = await safe(race(this.
|
|
36
|
+
const result = await safe(race(this.entityManagerProvider.getEntityManager(this.app), REQUEST_TIMEOUT));
|
|
37
37
|
if (result.success === true) {
|
|
38
38
|
return result.data;
|
|
39
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigApiService } from "./config-api-service.js";
|
|
2
2
|
import { Client } from "./client.js";
|
|
3
|
-
import {
|
|
3
|
+
import { EntityManagerProvider } from "./entity-manager-provider.js";
|
|
4
4
|
import { existsSync, writeFileSync } from "node:fs";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
@@ -22,8 +22,8 @@ export class ConfigApiServiceFactory {
|
|
|
22
22
|
throw new ApplicationError("app is undefined");
|
|
23
23
|
}
|
|
24
24
|
this.createLoginTokenFileIfNotExists();
|
|
25
|
-
const
|
|
26
|
-
const client = new Client(this.context.app,
|
|
25
|
+
const entityManagerProvider = new EntityManagerProvider();
|
|
26
|
+
const client = new Client(this.context.app, entityManagerProvider);
|
|
27
27
|
this.service = new ConfigApiService(this.context.app, client);
|
|
28
28
|
}
|
|
29
29
|
createLoginTokenFileIfNotExists() {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntityManager } from "baqend";
|
|
2
|
+
/**
|
|
3
|
+
* Logs in to an app once and hands out its `EntityManager` from then on.
|
|
4
|
+
*
|
|
5
|
+
* A connection provider, not a service factory: services receive it and ask it
|
|
6
|
+
* for a connection at run time.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EntityManagerProvider {
|
|
9
|
+
EntityManager: EntityManager;
|
|
10
|
+
getEntityManager(app: string): Promise<EntityManager>;
|
|
11
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { account } from "baqend/cli";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Logs in to an app once and hands out its `EntityManager` from then on.
|
|
4
|
+
*
|
|
5
|
+
* A connection provider, not a service factory: services receive it and ask it
|
|
6
|
+
* for a connection at run time.
|
|
7
|
+
*/
|
|
8
|
+
export class EntityManagerProvider {
|
|
3
9
|
EntityManager;
|
|
4
10
|
async getEntityManager(app) {
|
|
5
11
|
if (this.EntityManager) {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Interfaces } from "@oclif/core";
|
|
2
|
+
import { CommandContextValues, CliEnvironment } from "../cli/index.js";
|
|
3
|
+
declare const args: {};
|
|
4
|
+
declare const flags: {
|
|
5
|
+
app: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
6
|
+
customersDirectory: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
7
|
+
templates: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
8
|
+
mode: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
/** What `sk generate-customer-config` scaffolds, as the wizard reads it. */
|
|
11
|
+
export interface CustomerConfigOptions {
|
|
12
|
+
readonly appName: string;
|
|
13
|
+
readonly customersDirectory: string;
|
|
14
|
+
/** Explicit templates/ root; overrides checkout detection and the remote fetch. */
|
|
15
|
+
readonly templatesPath?: string;
|
|
16
|
+
/** Template set = wizard mode: "customer-config" (default) or "pre-poc". */
|
|
17
|
+
readonly mode: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CustomerConfigServiceBuildContextValues extends CommandContextValues, CustomerConfigOptions {
|
|
20
|
+
}
|
|
21
|
+
declare const CustomerConfigServiceBuildContext_base: new (values: CustomerConfigServiceBuildContextValues) => Readonly<CustomerConfigServiceBuildContextValues>;
|
|
22
|
+
/** What the customer config wizard is built from. */
|
|
23
|
+
export declare class CustomerConfigServiceBuildContext extends CustomerConfigServiceBuildContext_base {
|
|
24
|
+
static readonly args: {};
|
|
25
|
+
static readonly flags: {
|
|
26
|
+
app: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
27
|
+
customersDirectory: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
28
|
+
templates: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
29
|
+
mode: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
30
|
+
};
|
|
31
|
+
static create(parsedArgs: Interfaces.InferredArgs<typeof args>, parsedFlags: Interfaces.InferredFlags<typeof flags>, environment: CliEnvironment): CustomerConfigServiceBuildContext;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { Context } from "../../models/context.js";
|
|
3
|
+
const args = {};
|
|
4
|
+
const flags = {
|
|
5
|
+
app: Flags.string({
|
|
6
|
+
char: "a",
|
|
7
|
+
description: "The SK app name which is also being used the config output directory name (kebab-case)",
|
|
8
|
+
}),
|
|
9
|
+
customersDirectory: Flags.string({
|
|
10
|
+
char: "d",
|
|
11
|
+
description: `Name of the sk-onboarding directory where all customer configs are being stored (default: "customers")`,
|
|
12
|
+
}),
|
|
13
|
+
templates: Flags.string({
|
|
14
|
+
description: "Path to the templates/ root (default: the sk-onboarding checkout the CLI runs in, or the sk-onboarding repo on GitLab when run standalone)",
|
|
15
|
+
}),
|
|
16
|
+
mode: Flags.string({
|
|
17
|
+
options: ["customer-config", "pre-poc"],
|
|
18
|
+
default: "customer-config",
|
|
19
|
+
description: "Which config to scaffold: the full acceleration config, or the tracking-only pre-PoC config",
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
/** What the customer config wizard is built from. */
|
|
23
|
+
export class CustomerConfigServiceBuildContext extends Context() {
|
|
24
|
+
static args = args;
|
|
25
|
+
static flags = flags;
|
|
26
|
+
static create(parsedArgs, parsedFlags, environment) {
|
|
27
|
+
return new CustomerConfigServiceBuildContext({
|
|
28
|
+
environment,
|
|
29
|
+
appName: parsedFlags.app ?? "",
|
|
30
|
+
customersDirectory: parsedFlags.customersDirectory ?? "customers",
|
|
31
|
+
templatesPath: parsedFlags.templates,
|
|
32
|
+
mode: parsedFlags.mode ?? "customer-config",
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
CustomerConfigServiceBuildContext;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CustomerConfigService } from "./customer-config-service.js";
|
|
2
|
+
import { CustomerConfigServiceBuildContext } from "./customer-config-service-build-context.js";
|
|
3
3
|
export declare class CustomerConfigServiceFactory {
|
|
4
|
-
private cli?;
|
|
5
4
|
private readonly context;
|
|
6
5
|
private service?;
|
|
7
|
-
constructor(context:
|
|
6
|
+
constructor(context: CustomerConfigServiceBuildContext);
|
|
8
7
|
buildService(): Promise<CustomerConfigService>;
|
|
9
8
|
private build;
|
|
10
9
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SiteAnalyzerServiceFactory } from "./site-analyzer/index.js";
|
|
1
|
+
import { CustomerConfigService } from "./customer-config-service.js";
|
|
2
|
+
import { SiteAnalyzerServiceBuildContext, SiteAnalyzerServiceFactory, } from "./site-analyzer/index.js";
|
|
4
3
|
export class CustomerConfigServiceFactory {
|
|
5
|
-
cli;
|
|
6
4
|
context;
|
|
7
5
|
service;
|
|
8
|
-
constructor(context
|
|
9
|
-
this.cli = cli;
|
|
6
|
+
constructor(context) {
|
|
10
7
|
this.context = context;
|
|
11
8
|
}
|
|
12
9
|
async buildService() {
|
|
@@ -17,8 +14,8 @@ export class CustomerConfigServiceFactory {
|
|
|
17
14
|
}
|
|
18
15
|
async build() {
|
|
19
16
|
const context = this.context;
|
|
20
|
-
const cliService =
|
|
21
|
-
const siteAnalyzer = new SiteAnalyzerServiceFactory(
|
|
17
|
+
const cliService = context.environment.cli;
|
|
18
|
+
const siteAnalyzer = new SiteAnalyzerServiceFactory(new SiteAnalyzerServiceBuildContext({ environment: context.environment })).getService();
|
|
22
19
|
this.service = new CustomerConfigService(context, cliService, siteAnalyzer);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliServiceInterface } from "../cli/index.js";
|
|
2
2
|
import { SiteAnalyzerService } from "./site-analyzer/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { CustomerConfigOptions } from "./customer-config-service-build-context.js";
|
|
4
4
|
import { CustomerConfigSettings } from "./customer-config-service-model.js";
|
|
5
5
|
export declare class CustomerConfigService {
|
|
6
6
|
private context;
|
|
@@ -14,7 +14,7 @@ export declare class CustomerConfigService {
|
|
|
14
14
|
private get outputDirPath();
|
|
15
15
|
/** Set from the "Downtime Detection" feature answer in the wizard. */
|
|
16
16
|
private includeDowntimeDetection;
|
|
17
|
-
constructor(context:
|
|
17
|
+
constructor(context: CustomerConfigOptions, cli: CliServiceInterface, siteAnalyzer: SiteAnalyzerService);
|
|
18
18
|
private getOutputDirPath;
|
|
19
19
|
private getOutputFileName;
|
|
20
20
|
private getPathWithChangedDir;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "./customer-config-service.js";
|
|
2
|
-
export * from "./customer-config-service-context.js";
|
|
2
|
+
export * from "./customer-config-service-build-context.js";
|
|
3
3
|
export * from "./customer-config-service-model.js";
|
|
4
4
|
export * from "./customer-config-service-factory.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "./customer-config-service.js";
|
|
2
|
-
export * from "./customer-config-service-context.js";
|
|
2
|
+
export * from "./customer-config-service-build-context.js";
|
|
3
3
|
export * from "./customer-config-service-model.js";
|
|
4
4
|
export * from "./customer-config-service-factory.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CommandContextValues } from "../../cli/index.js";
|
|
2
|
+
declare const SiteAnalyzerServiceBuildContext_base: new (values: CommandContextValues) => Readonly<CommandContextValues>;
|
|
3
|
+
/** The site analyzer needs nothing but the invocation's environment. */
|
|
4
|
+
export declare class SiteAnalyzerServiceBuildContext extends SiteAnalyzerServiceBuildContext_base {
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SiteAnalyzerServiceBuildContext } from "./site-analyzer-service-build-context.js";
|
|
2
2
|
import { SiteAnalyzerService } from "./site-analyzer-service.js";
|
|
3
3
|
export declare class SiteAnalyzerServiceFactory {
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
4
|
+
private readonly context;
|
|
5
|
+
constructor(context: SiteAnalyzerServiceBuildContext);
|
|
6
6
|
getService(): SiteAnalyzerService;
|
|
7
7
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { CliServiceFactory } from "../../cli/index.js";
|
|
2
1
|
import { SiteAnalyzerService } from "./site-analyzer-service.js";
|
|
3
2
|
export class SiteAnalyzerServiceFactory {
|
|
4
|
-
|
|
5
|
-
constructor(
|
|
6
|
-
this.
|
|
3
|
+
context;
|
|
4
|
+
constructor(context) {
|
|
5
|
+
this.context = context;
|
|
7
6
|
}
|
|
8
7
|
getService() {
|
|
9
|
-
return new SiteAnalyzerService(this.cli
|
|
8
|
+
return new SiteAnalyzerService(this.context.environment.cli);
|
|
10
9
|
}
|
|
11
10
|
}
|
|
@@ -1,30 +1,5 @@
|
|
|
1
1
|
import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
|
|
2
2
|
import { MergeRequestDeployService } from "../mr/index.js";
|
|
3
|
-
/** What `sk bulk-deploy` is asked to deploy. */
|
|
4
|
-
export declare class BulkDeployContext {
|
|
5
|
-
/** Any path inside the repository that holds the customer configurations. */
|
|
6
|
-
readonly repositoryPath: string;
|
|
7
|
-
/** The number of the merged merge request. */
|
|
8
|
-
readonly iid: number;
|
|
9
|
-
/** The answer for the customers that approve every rollout themselves. */
|
|
10
|
-
readonly approval?: ApprovalAnswer;
|
|
11
|
-
/** The description of the installations. */
|
|
12
|
-
readonly description?: string;
|
|
13
|
-
readonly dryRun: boolean;
|
|
14
|
-
/** Run without the confirmation, for a pipeline that has no keyboard. */
|
|
15
|
-
readonly assumeYes: boolean;
|
|
16
|
-
constructor(
|
|
17
|
-
/** Any path inside the repository that holds the customer configurations. */
|
|
18
|
-
repositoryPath: string,
|
|
19
|
-
/** The number of the merged merge request. */
|
|
20
|
-
iid: number,
|
|
21
|
-
/** The answer for the customers that approve every rollout themselves. */
|
|
22
|
-
approval?: ApprovalAnswer,
|
|
23
|
-
/** The description of the installations. */
|
|
24
|
-
description?: string, dryRun?: boolean,
|
|
25
|
-
/** Run without the confirmation, for a pipeline that has no keyboard. */
|
|
26
|
-
assumeYes?: boolean);
|
|
27
|
-
}
|
|
28
3
|
/** One customer configuration that a merge request touches. */
|
|
29
4
|
export interface TouchedConfig {
|
|
30
5
|
/** The customer directory, as git spells it. */
|
|
@@ -1,27 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export class BulkDeployContext {
|
|
3
|
-
repositoryPath;
|
|
4
|
-
iid;
|
|
5
|
-
approval;
|
|
6
|
-
description;
|
|
7
|
-
dryRun;
|
|
8
|
-
assumeYes;
|
|
9
|
-
constructor(
|
|
10
|
-
/** Any path inside the repository that holds the customer configurations. */
|
|
11
|
-
repositoryPath,
|
|
12
|
-
/** The number of the merged merge request. */
|
|
13
|
-
iid,
|
|
14
|
-
/** The answer for the customers that approve every rollout themselves. */
|
|
15
|
-
approval,
|
|
16
|
-
/** The description of the installations. */
|
|
17
|
-
description, dryRun = false,
|
|
18
|
-
/** Run without the confirmation, for a pipeline that has no keyboard. */
|
|
19
|
-
assumeYes = false) {
|
|
20
|
-
this.repositoryPath = repositoryPath;
|
|
21
|
-
this.iid = iid;
|
|
22
|
-
this.approval = approval;
|
|
23
|
-
this.description = description;
|
|
24
|
-
this.dryRun = dryRun;
|
|
25
|
-
this.assumeYes = assumeYes;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Interfaces } from "@oclif/core";
|
|
2
|
+
import { CliEnvironment, CommandContextValues } from "../../cli/index.js";
|
|
3
|
+
import { ApprovalAnswer } from "../policy/auto-deploy-policy.js";
|
|
4
|
+
declare const args: {
|
|
5
|
+
mr: Interfaces.Arg<number, {
|
|
6
|
+
max?: number;
|
|
7
|
+
min?: number;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
declare const flags: {
|
|
11
|
+
repository: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
12
|
+
approval: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
13
|
+
description: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
14
|
+
dryRun: Interfaces.BooleanFlag<boolean>;
|
|
15
|
+
yes: Interfaces.BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
/** What `sk bulk-deploy` is asked to deploy, as the run reads it. */
|
|
18
|
+
export interface BulkDeployOptions {
|
|
19
|
+
/** Any path inside the repository that holds the customer configurations. */
|
|
20
|
+
readonly repositoryPath: string;
|
|
21
|
+
/** The number of the merged merge request. */
|
|
22
|
+
readonly iid: number;
|
|
23
|
+
/** The answer for the customers that approve every rollout themselves. */
|
|
24
|
+
readonly approval?: ApprovalAnswer;
|
|
25
|
+
/** The description of the installations. */
|
|
26
|
+
readonly description?: string;
|
|
27
|
+
readonly dryRun?: boolean;
|
|
28
|
+
/** Run without the confirmation, for a pipeline that has no keyboard. */
|
|
29
|
+
readonly assumeYes?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface BulkDeployServiceBuildContextValues extends CommandContextValues, BulkDeployOptions {
|
|
32
|
+
}
|
|
33
|
+
declare const BulkDeployServiceBuildContext_base: new (values: BulkDeployServiceBuildContextValues) => Readonly<BulkDeployServiceBuildContextValues>;
|
|
34
|
+
/** What `sk bulk-deploy` is built from. */
|
|
35
|
+
export declare class BulkDeployServiceBuildContext extends BulkDeployServiceBuildContext_base {
|
|
36
|
+
static readonly args: {
|
|
37
|
+
mr: Interfaces.Arg<number, {
|
|
38
|
+
max?: number;
|
|
39
|
+
min?: number;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
static readonly flags: {
|
|
43
|
+
repository: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
44
|
+
approval: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
45
|
+
description: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
46
|
+
dryRun: Interfaces.BooleanFlag<boolean>;
|
|
47
|
+
yes: Interfaces.BooleanFlag<boolean>;
|
|
48
|
+
};
|
|
49
|
+
static create(parsedArgs: Interfaces.InferredArgs<typeof args>, parsedFlags: Interfaces.InferredFlags<typeof flags>, environment: CliEnvironment): BulkDeployServiceBuildContext;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Args, Flags } from "@oclif/core";
|
|
2
|
+
import { Context } from "../../../models/context.js";
|
|
3
|
+
const args = {
|
|
4
|
+
mr: Args.integer({
|
|
5
|
+
name: "mr",
|
|
6
|
+
required: true,
|
|
7
|
+
description: "The number of the merged merge request",
|
|
8
|
+
}),
|
|
9
|
+
};
|
|
10
|
+
const flags = {
|
|
11
|
+
repository: Flags.directory({
|
|
12
|
+
char: "r",
|
|
13
|
+
default: ".",
|
|
14
|
+
description: "A path in the repository that holds the customer configs",
|
|
15
|
+
}),
|
|
16
|
+
approval: Flags.string({
|
|
17
|
+
options: ["approved", "testing", "skip"],
|
|
18
|
+
description: "what to do with a customer that approves every rollout themselves",
|
|
19
|
+
}),
|
|
20
|
+
description: Flags.string({
|
|
21
|
+
description: "the description every installation of the run gets, asked while it is left out",
|
|
22
|
+
}),
|
|
23
|
+
dryRun: Flags.boolean({
|
|
24
|
+
char: "d",
|
|
25
|
+
default: false,
|
|
26
|
+
description: "dry run",
|
|
27
|
+
}),
|
|
28
|
+
yes: Flags.boolean({
|
|
29
|
+
char: "y",
|
|
30
|
+
default: false,
|
|
31
|
+
description: "deploy the plan without the confirmation",
|
|
32
|
+
}),
|
|
33
|
+
};
|
|
34
|
+
/** What `sk bulk-deploy` is built from. */
|
|
35
|
+
export class BulkDeployServiceBuildContext extends Context() {
|
|
36
|
+
static args = args;
|
|
37
|
+
static flags = flags;
|
|
38
|
+
static create(parsedArgs, parsedFlags, environment) {
|
|
39
|
+
return new BulkDeployServiceBuildContext({
|
|
40
|
+
environment,
|
|
41
|
+
repositoryPath: parsedFlags.repository,
|
|
42
|
+
iid: parsedArgs.mr,
|
|
43
|
+
approval: parsedFlags.approval,
|
|
44
|
+
description: parsedFlags.description,
|
|
45
|
+
dryRun: parsedFlags.dryRun,
|
|
46
|
+
assumeYes: parsedFlags.yes,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
BulkDeployServiceBuildContext;
|