@speedkit/cli 4.36.1 → 4.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +12 -5
- 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 +19 -3
- package/dist/commands/onboarding.js +15 -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/browse/browse-service.d.ts +18 -0
- package/dist/services/onboarding/browse/browse-service.js +61 -0
- package/dist/services/onboarding/browse/browse-url.d.ts +10 -0
- package/dist/services/onboarding/browse/browse-url.js +19 -0
- 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 +20 -16
- package/dist/services/onboarding/browser/extension/extension-downloader.d.ts +3 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +8 -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/browser/launch-browser.d.ts +9 -0
- package/dist/services/onboarding/browser/launch-browser.js +20 -0
- package/dist/services/onboarding/error/browse-domain-error.d.ts +6 -0
- package/dist/services/onboarding/error/browse-domain-error.js +11 -0
- package/dist/services/onboarding/error/missing-customer-path-error.d.ts +6 -0
- package/dist/services/onboarding/error/missing-customer-path-error.js +11 -0
- 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 +61 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +79 -0
- package/dist/services/onboarding/onboarding-service-factory.d.ts +31 -6
- package/dist/services/onboarding/onboarding-service-factory.js +120 -48
- package/dist/services/onboarding/onboarding-service.d.ts +2 -0
- package/dist/services/onboarding/onboarding-service.js +5 -16
- package/dist/services/onboarding/spec/browse/browse-url.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browse/browse-url.spec.js +28 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +11 -6
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +155 -0
- 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 +155 -147
- 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
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
2
2
|
export class BrowserSetupService {
|
|
3
3
|
cli;
|
|
4
|
-
|
|
5
|
-
userConfig;
|
|
4
|
+
environment;
|
|
6
5
|
detector;
|
|
7
6
|
manager;
|
|
8
|
-
constructor(cli,
|
|
7
|
+
constructor(cli, environment, detector, manager) {
|
|
9
8
|
this.cli = cli;
|
|
10
|
-
this.
|
|
11
|
-
this.userConfig = userConfig;
|
|
9
|
+
this.environment = environment;
|
|
12
10
|
this.detector = detector;
|
|
13
11
|
this.manager = manager;
|
|
14
12
|
}
|
|
@@ -32,7 +30,7 @@ export class BrowserSetupService {
|
|
|
32
30
|
value: "install:experimental",
|
|
33
31
|
},
|
|
34
32
|
];
|
|
35
|
-
const currentDefault = detected.find((browser) => browser.executablePath === this.
|
|
33
|
+
const currentDefault = detected.find((browser) => browser.executablePath === this.environment.settings.chromePath)?.id;
|
|
36
34
|
const selected = await this.cli.select("Which browser should Speed Kit use?", choices, currentDefault);
|
|
37
35
|
if (selected.startsWith("install:")) {
|
|
38
36
|
const channel = selected.slice("install:".length);
|
|
@@ -44,7 +42,7 @@ export class BrowserSetupService {
|
|
|
44
42
|
this.cli.writeError("Selected browser could not be resolved.");
|
|
45
43
|
return;
|
|
46
44
|
}
|
|
47
|
-
this.
|
|
45
|
+
this.environment.save({
|
|
48
46
|
chromePath: chosen.executablePath,
|
|
49
47
|
// a manually selected browser is not update-managed by the wizard, so
|
|
50
48
|
// clear the channel to disable the update reminder for it
|
|
@@ -60,7 +58,7 @@ export class BrowserSetupService {
|
|
|
60
58
|
* callers must ensure the session is interactive first.
|
|
61
59
|
*/
|
|
62
60
|
async remindIfDue() {
|
|
63
|
-
const channel = this.
|
|
61
|
+
const channel = this.environment.settings.browserChannel;
|
|
64
62
|
if (channel !== "stable" && channel !== "experimental") {
|
|
65
63
|
return;
|
|
66
64
|
}
|
|
@@ -76,11 +74,11 @@ export class BrowserSetupService {
|
|
|
76
74
|
return;
|
|
77
75
|
}
|
|
78
76
|
// stamp the check regardless so we don't re-check until the next interval
|
|
79
|
-
this.
|
|
80
|
-
if (latestBuildId === this.
|
|
77
|
+
this.environment.save({ lastBrowserUpdateCheck: this.nowIso() });
|
|
78
|
+
if (latestBuildId === this.environment.settings.browserBuildId) {
|
|
81
79
|
return;
|
|
82
80
|
}
|
|
83
|
-
if (this.
|
|
81
|
+
if (this.environment.settings.browserAutoUpdate) {
|
|
84
82
|
await this.installAndPersist(channel);
|
|
85
83
|
return;
|
|
86
84
|
}
|
|
@@ -93,34 +91,34 @@ export class BrowserSetupService {
|
|
|
93
91
|
}
|
|
94
92
|
async installAndPersist(channel) {
|
|
95
93
|
const installed = await this.manager.installChannel(channel);
|
|
96
|
-
this.
|
|
94
|
+
this.environment.save({
|
|
97
95
|
chromePath: installed.executablePath,
|
|
98
96
|
browserChannel: channel,
|
|
99
97
|
browserBuildId: installed.buildId,
|
|
100
98
|
lastBrowserUpdateCheck: this.nowIso(),
|
|
101
99
|
});
|
|
102
|
-
const autoUpdate = await this.cli.confirm("Automatically update the browser when a newer build is available?", this.
|
|
103
|
-
this.
|
|
100
|
+
const autoUpdate = await this.cli.confirm("Automatically update the browser when a newer build is available?", this.environment.settings.browserAutoUpdate);
|
|
101
|
+
this.environment.save({ browserAutoUpdate: autoUpdate });
|
|
104
102
|
if (!autoUpdate) {
|
|
105
103
|
await this.askReminderDays();
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
106
|
async askReminderDays() {
|
|
109
107
|
const answer = await this.cli.prompt("Remind me to check for browser updates in how many days?", {
|
|
110
|
-
defaultAnswer: String(this.
|
|
108
|
+
defaultAnswer: String(this.environment.settings.updateReminderDays || 3),
|
|
111
109
|
validator: (value) => /^\d+$/.test(value.trim()) ? "" : "Enter a whole number of days",
|
|
112
110
|
});
|
|
113
111
|
const days = Number.parseInt(answer, 10);
|
|
114
112
|
if (!Number.isNaN(days) && days > 0) {
|
|
115
|
-
this.
|
|
113
|
+
this.environment.save({
|
|
116
114
|
updateReminderDays: days,
|
|
117
115
|
lastBrowserUpdateCheck: this.nowIso(),
|
|
118
116
|
});
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
isReminderDue() {
|
|
122
|
-
const days = this.
|
|
123
|
-
const last = this.
|
|
120
|
+
const days = this.environment.settings.updateReminderDays || 3;
|
|
121
|
+
const last = this.environment.settings.lastBrowserUpdateCheck;
|
|
124
122
|
if (!last) {
|
|
125
123
|
return true;
|
|
126
124
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CliEnvironment, CliServiceInterface } from "../../cli/index.js";
|
|
2
2
|
import { DiffToolDetector } from "./difftool-detector.js";
|
|
3
3
|
export declare class DiffToolSetupService {
|
|
4
4
|
private readonly cli;
|
|
5
|
-
private readonly
|
|
6
|
-
private readonly userConfig;
|
|
5
|
+
private readonly environment;
|
|
7
6
|
private readonly detector;
|
|
8
|
-
constructor(cli: CliServiceInterface,
|
|
7
|
+
constructor(cli: CliServiceInterface, environment: CliEnvironment, detector: DiffToolDetector);
|
|
9
8
|
/**
|
|
10
9
|
* Detects installed editors/diff tools, lets the user pick one, and persists
|
|
11
10
|
* it as diffExec + diffExecTemplate + diffTool.
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
export class DiffToolSetupService {
|
|
2
2
|
cli;
|
|
3
|
-
|
|
4
|
-
userConfig;
|
|
3
|
+
environment;
|
|
5
4
|
detector;
|
|
6
|
-
constructor(cli,
|
|
5
|
+
constructor(cli, environment, detector) {
|
|
7
6
|
this.cli = cli;
|
|
8
|
-
this.
|
|
9
|
-
this.userConfig = userConfig;
|
|
7
|
+
this.environment = environment;
|
|
10
8
|
this.detector = detector;
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
@@ -27,7 +25,7 @@ export class DiffToolSetupService {
|
|
|
27
25
|
})),
|
|
28
26
|
{ name: "Skip — configure manually later", value: "skip" },
|
|
29
27
|
];
|
|
30
|
-
const selected = await this.cli.select("Which diff tool should Speed Kit use?", choices, this.
|
|
28
|
+
const selected = await this.cli.select("Which diff tool should Speed Kit use?", choices, this.environment.settings.diffTool || undefined);
|
|
31
29
|
if (selected === "skip") {
|
|
32
30
|
return;
|
|
33
31
|
}
|
|
@@ -36,7 +34,7 @@ export class DiffToolSetupService {
|
|
|
36
34
|
this.cli.writeError("Selected diff tool could not be resolved.");
|
|
37
35
|
return;
|
|
38
36
|
}
|
|
39
|
-
this.
|
|
37
|
+
this.environment.save({
|
|
40
38
|
diffTool: chosen.id,
|
|
41
39
|
diffExec: chosen.executablePath,
|
|
42
40
|
diffExecTemplate: chosen.diffExecTemplate,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CliEnvironment, CliServiceInterface, ManagedExtension } from "../../cli/index.js";
|
|
2
2
|
import { ExtensionInstaller } from "./extension-installer.js";
|
|
3
3
|
export declare class ExtensionSetupService {
|
|
4
4
|
private readonly cli;
|
|
5
|
-
private readonly
|
|
6
|
-
private readonly userConfig;
|
|
5
|
+
private readonly environment;
|
|
7
6
|
private readonly installer;
|
|
8
|
-
constructor(cli: CliServiceInterface,
|
|
7
|
+
constructor(cli: CliServiceInterface, environment: CliEnvironment, installer: ExtensionInstaller);
|
|
9
8
|
/**
|
|
10
9
|
* Wizard step: optionally install one or more Chrome extensions by id/URL.
|
|
11
10
|
*/
|
|
@@ -2,13 +2,11 @@ import { compareVersions } from "./webstore.js";
|
|
|
2
2
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
3
3
|
export class ExtensionSetupService {
|
|
4
4
|
cli;
|
|
5
|
-
|
|
6
|
-
userConfig;
|
|
5
|
+
environment;
|
|
7
6
|
installer;
|
|
8
|
-
constructor(cli,
|
|
7
|
+
constructor(cli, environment, installer) {
|
|
9
8
|
this.cli = cli;
|
|
10
|
-
this.
|
|
11
|
-
this.userConfig = userConfig;
|
|
9
|
+
this.environment = environment;
|
|
12
10
|
this.installer = installer;
|
|
13
11
|
}
|
|
14
12
|
/**
|
|
@@ -81,7 +79,7 @@ export class ExtensionSetupService {
|
|
|
81
79
|
async updateAll() {
|
|
82
80
|
const list = this.current();
|
|
83
81
|
// stamp so the daily reminder does not immediately ask again
|
|
84
|
-
this.
|
|
82
|
+
this.environment.save({ lastExtensionUpdateCheck: this.nowIso() });
|
|
85
83
|
for (const ext of list) {
|
|
86
84
|
await this.remindOne(ext);
|
|
87
85
|
}
|
|
@@ -110,7 +108,7 @@ export class ExtensionSetupService {
|
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
current() {
|
|
113
|
-
return this.
|
|
111
|
+
return this.environment.settings.managedChromeExtensions ?? [];
|
|
114
112
|
}
|
|
115
113
|
upsert(list, ext) {
|
|
116
114
|
return [...list.filter((entry) => entry.id !== ext.id), ext];
|
|
@@ -123,20 +121,20 @@ export class ExtensionSetupService {
|
|
|
123
121
|
persist(managed) {
|
|
124
122
|
const managedDir = this.installer.extensionsDir;
|
|
125
123
|
const managedPaths = new Set(managed.map((ext) => ext.path));
|
|
126
|
-
const manualPaths = this.
|
|
124
|
+
const manualPaths = this.environment.settings.chromeExtensionPaths
|
|
127
125
|
.split(",")
|
|
128
126
|
.map((entry) => entry.trim())
|
|
129
127
|
.filter((entry) => entry.length > 0 &&
|
|
130
128
|
!entry.startsWith(managedDir) &&
|
|
131
129
|
!managedPaths.has(entry));
|
|
132
130
|
const combined = [...manualPaths, ...managed.map((ext) => ext.path)];
|
|
133
|
-
this.
|
|
131
|
+
this.environment.save({
|
|
134
132
|
managedChromeExtensions: managed,
|
|
135
133
|
chromeExtensionPaths: combined.join(","),
|
|
136
134
|
});
|
|
137
135
|
}
|
|
138
136
|
isCheckDue() {
|
|
139
|
-
const last = this.
|
|
137
|
+
const last = this.environment.settings.lastExtensionUpdateCheck;
|
|
140
138
|
if (!last) {
|
|
141
139
|
return true;
|
|
142
140
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Interfaces } from "@oclif/core";
|
|
2
|
+
import { CliEnvironment, CommandContextValues } from "../cli/index.js";
|
|
3
|
+
declare const args: {};
|
|
4
|
+
declare const flags: {
|
|
5
|
+
force: Interfaces.BooleanFlag<boolean>;
|
|
6
|
+
postInstall: Interfaces.BooleanFlag<boolean>;
|
|
7
|
+
};
|
|
8
|
+
/** How the first-run wizard runs, as the wizard reads it. */
|
|
9
|
+
export interface SetupOptions {
|
|
10
|
+
/** true when invoked from the npm postinstall hook */
|
|
11
|
+
readonly postInstall?: boolean;
|
|
12
|
+
/** re-run even if setup was already completed */
|
|
13
|
+
readonly force?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface SetupServiceBuildContextValues extends CommandContextValues, SetupOptions {
|
|
16
|
+
}
|
|
17
|
+
declare const SetupServiceBuildContext_base: new (values: SetupServiceBuildContextValues) => Readonly<SetupServiceBuildContextValues>;
|
|
18
|
+
/** What the setup wizard and the extension commands are built from. */
|
|
19
|
+
export declare class SetupServiceBuildContext extends SetupServiceBuildContext_base {
|
|
20
|
+
static readonly args: {};
|
|
21
|
+
static readonly flags: {
|
|
22
|
+
force: Interfaces.BooleanFlag<boolean>;
|
|
23
|
+
postInstall: Interfaces.BooleanFlag<boolean>;
|
|
24
|
+
};
|
|
25
|
+
static create(_parsedArgs: Interfaces.InferredArgs<typeof args>, parsedFlags: Interfaces.InferredFlags<typeof flags>, environment: CliEnvironment): SetupServiceBuildContext;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { Context } from "../../models/context.js";
|
|
3
|
+
const args = {};
|
|
4
|
+
const flags = {
|
|
5
|
+
force: Flags.boolean({
|
|
6
|
+
char: "f",
|
|
7
|
+
description: "Re-run even if setup was already completed",
|
|
8
|
+
}),
|
|
9
|
+
postInstall: Flags.boolean({
|
|
10
|
+
hidden: true,
|
|
11
|
+
description: "Internal flag used by the npm postinstall hook",
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
/** What the setup wizard and the extension commands are built from. */
|
|
15
|
+
export class SetupServiceBuildContext extends Context() {
|
|
16
|
+
static args = args;
|
|
17
|
+
static flags = flags;
|
|
18
|
+
static create(_parsedArgs, parsedFlags, environment) {
|
|
19
|
+
return new SetupServiceBuildContext({
|
|
20
|
+
environment,
|
|
21
|
+
postInstall: parsedFlags.postInstall,
|
|
22
|
+
force: parsedFlags.force,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
SetupServiceBuildContext;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CliServiceInterface } from "../cli/index.js";
|
|
3
|
-
import { SetupContext } from "./setup-context.js";
|
|
1
|
+
import { SetupServiceBuildContext } from "./setup-service-build-context.js";
|
|
4
2
|
import { SetupService } from "./setup-service.js";
|
|
5
3
|
export declare class SetupServiceFactory {
|
|
6
|
-
private readonly oclifConfig;
|
|
7
4
|
private readonly context;
|
|
8
|
-
private readonly cli?;
|
|
9
5
|
private service?;
|
|
10
|
-
constructor(
|
|
6
|
+
constructor(context: SetupServiceBuildContext);
|
|
11
7
|
getService(): SetupService;
|
|
12
8
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CliConfig, CliServiceFactory, } from "../cli/index.js";
|
|
2
1
|
import { normalizePlatform } from "./os/tool-registry.js";
|
|
3
2
|
import { BrowserDetector } from "./browser/browser-detector.js";
|
|
4
3
|
import { BrowserManager } from "./browser/browser-manager.js";
|
|
@@ -7,36 +6,29 @@ import { DiffToolDetector } from "./difftool/difftool-detector.js";
|
|
|
7
6
|
import { DiffToolSetupService } from "./difftool/difftool-setup-service.js";
|
|
8
7
|
import { ExtensionInstaller, resolveChromeMajorVersion, } from "./extension/extension-installer.js";
|
|
9
8
|
import { ExtensionSetupService } from "./extension/extension-setup-service.js";
|
|
10
|
-
import { SetupContext } from "./setup-context.js";
|
|
11
9
|
import { SetupService } from "./setup-service.js";
|
|
12
10
|
export class SetupServiceFactory {
|
|
13
|
-
oclifConfig;
|
|
14
11
|
context;
|
|
15
|
-
cli;
|
|
16
12
|
service;
|
|
17
|
-
constructor(
|
|
18
|
-
this.oclifConfig = oclifConfig;
|
|
13
|
+
constructor(context) {
|
|
19
14
|
this.context = context;
|
|
20
|
-
this.cli = cli;
|
|
21
15
|
}
|
|
22
16
|
getService() {
|
|
23
17
|
if (this.service instanceof SetupService) {
|
|
24
18
|
return this.service;
|
|
25
19
|
}
|
|
26
|
-
const cli = this.cli
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const home = this.oclifConfig.home;
|
|
31
|
-
const cacheDir = userConfig.tempFolder;
|
|
20
|
+
const cli = this.context.environment.cli;
|
|
21
|
+
const platform = normalizePlatform(this.context.environment.oclif.platform);
|
|
22
|
+
const home = this.context.environment.oclif.home;
|
|
23
|
+
const cacheDir = this.context.environment.cacheDir;
|
|
32
24
|
const browserDetector = new BrowserDetector(platform, home, cacheDir);
|
|
33
25
|
const browserManager = new BrowserManager(cacheDir, cli);
|
|
34
|
-
const browserSetup = new BrowserSetupService(cli,
|
|
26
|
+
const browserSetup = new BrowserSetupService(cli, this.context.environment, browserDetector, browserManager);
|
|
35
27
|
const diffDetector = new DiffToolDetector(platform, home);
|
|
36
|
-
const diffSetup = new DiffToolSetupService(cli,
|
|
37
|
-
const extensionInstaller = new ExtensionInstaller(cacheDir, resolveChromeMajorVersion(
|
|
38
|
-
const extensionSetup = new ExtensionSetupService(cli,
|
|
39
|
-
this.service = new SetupService(cli,
|
|
28
|
+
const diffSetup = new DiffToolSetupService(cli, this.context.environment, diffDetector);
|
|
29
|
+
const extensionInstaller = new ExtensionInstaller(cacheDir, resolveChromeMajorVersion(this.context.environment.settings.browserBuildId));
|
|
30
|
+
const extensionSetup = new ExtensionSetupService(cli, this.context.environment, extensionInstaller);
|
|
31
|
+
this.service = new SetupService(cli, this.context.environment, browserSetup, diffSetup, extensionSetup, this.context);
|
|
40
32
|
return this.service;
|
|
41
33
|
}
|
|
42
34
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { BrowserSetupService } from "./browser/browser-setup-service.js";
|
|
2
2
|
import { DiffToolSetupService } from "./difftool/difftool-setup-service.js";
|
|
3
3
|
import { ExtensionSetupService } from "./extension/extension-setup-service.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { SetupOptions } from "./setup-service-build-context.js";
|
|
5
|
+
import { CliEnvironment, CliServiceInterface } from "../cli/index.js";
|
|
6
6
|
export declare class SetupService {
|
|
7
7
|
private readonly cli;
|
|
8
|
-
private readonly
|
|
9
|
-
private readonly userConfig;
|
|
8
|
+
private readonly environment;
|
|
10
9
|
private readonly browserSetup;
|
|
11
10
|
private readonly diffSetup;
|
|
12
11
|
private readonly extensionSetup;
|
|
13
12
|
private readonly context;
|
|
14
|
-
constructor(cli: CliServiceInterface,
|
|
13
|
+
constructor(cli: CliServiceInterface, environment: CliEnvironment, browserSetup: BrowserSetupService, diffSetup: DiffToolSetupService, extensionSetup: ExtensionSetupService, context: SetupOptions);
|
|
15
14
|
/**
|
|
16
15
|
* Runs the full first-run wizard (browser + diff tool + extensions) and marks
|
|
17
16
|
* it done.
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
export class SetupService {
|
|
2
2
|
cli;
|
|
3
|
-
|
|
4
|
-
userConfig;
|
|
3
|
+
environment;
|
|
5
4
|
browserSetup;
|
|
6
5
|
diffSetup;
|
|
7
6
|
extensionSetup;
|
|
8
7
|
context;
|
|
9
|
-
constructor(cli,
|
|
8
|
+
constructor(cli, environment, browserSetup, diffSetup, extensionSetup, context) {
|
|
10
9
|
this.cli = cli;
|
|
11
|
-
this.
|
|
12
|
-
this.userConfig = userConfig;
|
|
10
|
+
this.environment = environment;
|
|
13
11
|
this.browserSetup = browserSetup;
|
|
14
12
|
this.diffSetup = diffSetup;
|
|
15
13
|
this.extensionSetup = extensionSetup;
|
|
@@ -29,13 +27,14 @@ export class SetupService {
|
|
|
29
27
|
await this.diffSetup.run();
|
|
30
28
|
this.cli.spacer();
|
|
31
29
|
await this.extensionSetup.run();
|
|
32
|
-
this.
|
|
30
|
+
this.environment.save({ firstRunCompleted: true });
|
|
33
31
|
this.cli.spacer();
|
|
34
32
|
this.cli.writeSuccess("Setup complete. Re-run any time with `sk config setup`.");
|
|
35
33
|
}
|
|
36
34
|
/** True when the first-run wizard has already been completed once. */
|
|
37
35
|
isFirstRunCompleted() {
|
|
38
|
-
return Boolean(this.
|
|
36
|
+
return (Boolean(this.environment.settings.firstRunCompleted) &&
|
|
37
|
+
!this.context.force);
|
|
39
38
|
}
|
|
40
39
|
/** Update-reminder check for the browser, used by the init hook. */
|
|
41
40
|
async remindBrowserUpdate() {
|