@speedkit/cli 4.43.0-beta.1 → 4.43.1

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +9 -2
  2. package/README.md +12 -2
  3. package/dist/commands/onboarding.d.ts +3 -0
  4. package/dist/commands/onboarding.js +7 -1
  5. package/dist/models/files.d.ts +0 -1
  6. package/dist/models/files.js +0 -1
  7. package/dist/services/bundler/bundle-service-factory.d.ts +1 -6
  8. package/dist/services/bundler/bundle-service-factory.js +2 -9
  9. package/dist/services/bundler/bundle-service.d.ts +1 -10
  10. package/dist/services/bundler/bundle-service.js +1 -16
  11. package/dist/services/bundler/index.d.ts +0 -1
  12. package/dist/services/bundler/index.js +0 -1
  13. package/dist/services/cli/cli-environment.js +0 -1
  14. package/dist/services/cli/cli-settings.d.ts +0 -5
  15. package/dist/services/cli/cli-settings.js +0 -1
  16. package/dist/services/deploy/checks/activation/customer-approval-check.js +1 -1
  17. package/dist/services/deploy/checks/post-deploy/refresh-deployment-job-check.d.ts +2 -2
  18. package/dist/services/deploy/checks/post-deploy/refresh-deployment-job-check.js +8 -7
  19. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.d.ts +2 -2
  20. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +11 -7
  21. package/dist/services/deploy/checks/post-deploy/save-files-check.d.ts +2 -2
  22. package/dist/services/deploy/checks/post-deploy/save-files-check.js +3 -2
  23. package/dist/services/deploy/checks/pre-deploy/device-detection-changed-check.js +3 -2
  24. package/dist/services/deploy/checks/pre-deploy/split-change-check.js +3 -2
  25. package/dist/services/deploy/deploy-service-factory.js +1 -3
  26. package/dist/services/deploy/deploy-service-model.d.ts +11 -1
  27. package/dist/services/deploy/deploy-service.d.ts +2 -0
  28. package/dist/services/deploy/deploy-service.js +26 -1
  29. package/dist/services/deploy/mr/merge-request-deploy-service-factory.js +1 -1
  30. package/dist/services/deploy/policy/deploy-policy-model.d.ts +1 -5
  31. package/dist/services/deploy/policy/deploy-policy-model.js +0 -4
  32. package/dist/services/deploy/spec/checks/post-deploy/refresh-deployment-job-check.spec.js +5 -12
  33. package/dist/services/deploy/spec/deploy-service.spec.js +64 -0
  34. package/dist/services/deploy/spec/policy/auto-deploy-policy.spec.js +0 -2
  35. package/dist/services/document-handler-runtime/document-handler-runtime-model.d.ts +0 -2
  36. package/dist/services/document-handler-runtime/document-handler-runtime-model.js +0 -2
  37. package/dist/services/document-handler-runtime/document-handler-server.d.ts +0 -17
  38. package/dist/services/document-handler-runtime/document-handler-server.js +20 -82
  39. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +1 -1
  40. package/dist/services/integration-api/integration-api-factory.js +1 -1
  41. package/dist/services/integration-api/integration-api-model.d.ts +1 -2
  42. package/dist/services/integration-api/spec/speed-kit-config-file.spec.js +8 -70
  43. package/dist/services/integration-api/struct/customer-config.d.ts +1 -19
  44. package/dist/services/integration-api/struct/customer-config.js +3 -11
  45. package/dist/services/integration-api/struct/speed-kit-config-file.d.ts +4 -9
  46. package/dist/services/integration-api/struct/speed-kit-config-file.js +10 -30
  47. package/dist/services/onboarding/config-renderer/speed-kit-install-context.js +8 -24
  48. package/dist/services/onboarding/error/inject-installation-error.d.ts +6 -0
  49. package/dist/services/onboarding/error/inject-installation-error.js +11 -0
  50. package/dist/services/onboarding/error/inject-target-error.d.ts +6 -0
  51. package/dist/services/onboarding/error/inject-target-error.js +11 -0
  52. package/dist/services/onboarding/error/missing-customer-path-error.d.ts +1 -1
  53. package/dist/services/onboarding/error/missing-customer-path-error.js +2 -1
  54. package/dist/services/onboarding/fetch-events/customer-domain-document-response.d.ts +4 -14
  55. package/dist/services/onboarding/fetch-events/customer-domain-document-response.js +6 -45
  56. package/dist/services/onboarding/fetch-events/document-rewrite.d.ts +19 -0
  57. package/dist/services/onboarding/fetch-events/document-rewrite.js +47 -0
  58. package/dist/services/onboarding/fetch-events/speed-kit-install-html.d.ts +5 -1
  59. package/dist/services/onboarding/fetch-events/speed-kit-install-html.js +7 -2
  60. package/dist/services/onboarding/html-rewrites.d.ts +3 -3
  61. package/dist/services/onboarding/html-rewrites.js +3 -3
  62. package/dist/services/onboarding/index.d.ts +1 -1
  63. package/dist/services/onboarding/index.js +1 -1
  64. package/dist/services/onboarding/inject/content-security-policy.d.ts +14 -0
  65. package/dist/services/onboarding/inject/content-security-policy.js +54 -0
  66. package/dist/services/onboarding/inject/deployed-installation.d.ts +15 -0
  67. package/dist/services/onboarding/inject/deployed-installation.js +32 -0
  68. package/dist/services/onboarding/inject/foreign-install-request.d.ts +27 -0
  69. package/dist/services/onboarding/inject/foreign-install-request.js +50 -0
  70. package/dist/services/onboarding/inject/inject-document-rewrite.d.ts +23 -0
  71. package/dist/services/onboarding/inject/inject-document-rewrite.js +52 -0
  72. package/dist/services/onboarding/inject/inject-service.d.ts +32 -0
  73. package/dist/services/onboarding/inject/inject-service.js +72 -0
  74. package/dist/services/onboarding/inject/injected-installation.d.ts +29 -0
  75. package/dist/services/onboarding/inject/injected-installation.js +37 -0
  76. package/dist/services/onboarding/onboarding-service-build-context.d.ts +15 -1
  77. package/dist/services/onboarding/onboarding-service-build-context.js +31 -2
  78. package/dist/services/onboarding/onboarding-service-factory.d.ts +23 -5
  79. package/dist/services/onboarding/onboarding-service-factory.js +87 -7
  80. package/dist/services/onboarding/spec/inject/content-security-policy.spec.d.ts +1 -0
  81. package/dist/services/onboarding/spec/inject/content-security-policy.spec.js +47 -0
  82. package/dist/services/onboarding/spec/inject/deployed-installation.spec.d.ts +1 -0
  83. package/dist/services/onboarding/spec/inject/deployed-installation.spec.js +49 -0
  84. package/dist/services/onboarding/spec/inject/foreign-install-request.spec.d.ts +1 -0
  85. package/dist/services/onboarding/spec/inject/foreign-install-request.spec.js +47 -0
  86. package/dist/services/onboarding/spec/inject/inject-document-rewrite.spec.d.ts +1 -0
  87. package/dist/services/onboarding/spec/inject/inject-document-rewrite.spec.js +66 -0
  88. package/dist/services/onboarding/spec/inject/injected-installation.spec.d.ts +1 -0
  89. package/dist/services/onboarding/spec/inject/injected-installation.spec.js +24 -0
  90. package/dist/services/onboarding/spec/onboarding-service-build-context.spec.d.ts +1 -0
  91. package/dist/services/onboarding/spec/onboarding-service-build-context.spec.js +22 -0
  92. package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +53 -2
  93. package/dist/services/onboarding/templates/install-speed-kit-html-template.js +3 -0
  94. package/dist/services/onboarding/templates/install-speed-kit-js-template.js +0 -5
  95. package/dist/services/query-builder/query-builder-factory.js +3 -3
  96. package/oclif.manifest.json +26 -3
  97. package/package.json +1 -2
  98. package/dist/services/bundler/error/packjockel-error.d.ts +0 -3
  99. package/dist/services/bundler/error/packjockel-error.js +0 -3
  100. package/dist/services/bundler/packjockel-service.d.ts +0 -70
  101. package/dist/services/bundler/packjockel-service.js +0 -171
  102. package/dist/services/bundler/spec/packjockel-service.spec.js +0 -149
  103. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.d.ts +0 -15
  104. package/dist/services/deploy/checks/post-deploy/deprecated-deployment-detection-check.js +0 -70
  105. package/dist/services/deploy/error/check-module-file-error.d.ts +0 -4
  106. package/dist/services/deploy/error/check-module-file-error.js +0 -4
  107. package/dist/services/deploy/error/post-deploy-deployment-detection-error.d.ts +0 -4
  108. package/dist/services/deploy/error/post-deploy-deployment-detection-error.js +0 -4
  109. /package/dist/services/{bundler/spec/packjockel-service.spec.d.ts → deploy/spec/deploy-service.spec.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,9 +1,16 @@
1
- # [4.43.0-beta.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.42.0...v4.43.0-beta.1) (2026-10-08)
1
+ ## [4.43.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.43.0...v4.43.1) (2026-10-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deploy:** post deploy checks don't throw errors ([887747b](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/887747be797ec13afa691a80cd312782bbcabdd1))
7
+
8
+ # [4.43.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.42.0...v4.43.0) (2026-10-09)
2
9
 
3
10
 
4
11
  ### Features
5
12
 
6
- * bundle with packjockel for customers with the configPlugins feature ([32e7ce6](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/32e7ce69a51b7501e32a65e4f38773daffc58a03))
13
+ * **onboarding:** add --inject, a deployed installation on the real site ([fcc0a97](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/fcc0a9708e3acdd3a32a2a96f4779c59534242c5))
7
14
 
8
15
  # [4.42.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.41.2...v4.42.0) (2026-10-07)
9
16
 
package/README.md CHANGED
@@ -728,10 +728,10 @@ Start a local dev environment for building and testing the Speed Kit configurati
728
728
  ```
729
729
  USAGE
730
730
  $ sk onboarding [CUSTOMERPATH] [-c <value>] [-t] [-d <value>] [-p] [--debugPort <value>] [-v] [-s]
731
- [--headless] [--browse] [--browserFetch]
731
+ [--headless] [--app <value> [--inject [<installationId>] | --browse]] [--browserFetch]
732
732
 
733
733
  ARGUMENTS
734
- [CUSTOMERPATH] The customer config path (optional with --browse)
734
+ [CUSTOMERPATH] The customer config path (optional with --browse and --inject)
735
735
 
736
736
  FLAGS
737
737
  -c, --configName=<value> [default: production] The costumer config name
@@ -740,6 +740,8 @@ FLAGS
740
740
  -s, --ignoreContentSecurityPolicy Removes header/meta "content-security-policy" for origin-responses
741
741
  -t, --useTestConfig Override app with configured testApp
742
742
  -v, --verboseLevel Show all messages
743
+ --app=<value> The app of the installation that --inject uses. Wins over the app of the customer
744
+ config.
743
745
  --browse Open the live site in the onboarding Chrome, with its extensions, but without
744
746
  request interception or Speed Kit injection. Takes the domain from -d or from the
745
747
  customer config.
@@ -750,6 +752,10 @@ FLAGS
750
752
  distinct ports to run multiple onboarding processes at once.
751
753
  --headless Run Chrome in headless mode (for CI environments). Implicitly enables remote
752
754
  debugging port.
755
+ --inject=[<installationId>] Inject a deployed Speed Kit installation into the site, for a customer that has not
756
+ installed Speed Kit. Without a value it uses the latest deployed installation. With
757
+ an id it uses that testing installation. Needs no local config: without a
758
+ CUSTOMERPATH, pass --app and -d.
753
759
 
754
760
  DESCRIPTION
755
761
  Start a local dev environment for building and testing the Speed Kit configuration
@@ -762,6 +768,10 @@ EXAMPLES
762
768
  $ sk onboarding --browse -d www.decathlon.de --headless --debugPort 9290
763
769
 
764
770
  $ sk onboarding customers/decathlon.de --browse -p
771
+
772
+ $ sk onboarding customers/decathlon.de --inject
773
+
774
+ $ sk onboarding customers/decathlon.de --inject <installationId>
765
775
  ```
766
776
 
767
777
  ## `sk origin-request CUSTOMERPATH PAGEURL`
@@ -17,11 +17,14 @@ export default class Onboarding extends SkCommand<OnboardingServiceBuildContext>
17
17
  ignoreContentSecurityPolicy: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
18
  headless: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
19
  browse: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
+ inject: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
21
+ app: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
22
  browserFetch: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
23
  useTestConfig: import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
24
  configName: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
23
25
  };
24
26
  static examples: string[];
27
+ init(): Promise<void>;
25
28
  /** Onboarding runs the customer's documentHandler, with its node modules. */
26
29
  protected customerPathForModules(args: Record<string, unknown>): string | undefined;
27
30
  run(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { SkCommand } from "../base/sk-command.js";
2
- import { OnboardingServiceBuildContext, OnboardingServiceFactory, } from "../services/onboarding/index.js";
2
+ import { OnboardingServiceBuildContext, OnboardingServiceFactory, withInjectDefault, } from "../services/onboarding/index.js";
3
3
  export default class Onboarding extends SkCommand {
4
4
  static description = "Start a local dev environment for building and testing the Speed Kit configuration";
5
5
  static buildContext = OnboardingServiceBuildContext;
@@ -10,7 +10,13 @@ export default class Onboarding extends SkCommand {
10
10
  `$ sk onboarding customers/decathlon.de -c production -d www.decathlon.de`,
11
11
  `$ sk onboarding --browse -d www.decathlon.de --headless --debugPort 9290`,
12
12
  `$ sk onboarding customers/decathlon.de --browse -p`,
13
+ `$ sk onboarding customers/decathlon.de --inject`,
14
+ `$ sk onboarding customers/decathlon.de --inject <installationId>`,
13
15
  ];
16
+ async init() {
17
+ this.argv = withInjectDefault(this.argv);
18
+ await super.init();
19
+ }
14
20
  /** Onboarding runs the customer's documentHandler, with its node modules. */
15
21
  customerPathForModules(args) {
16
22
  return args.customerPath;
@@ -19,6 +19,5 @@ export declare const INTEGRATION_FILES: {
19
19
  };
20
20
  DEPRECATED: {
21
21
  ASSET_HANDLER: string;
22
- DEPLOYMENT_DETECTION: string;
23
22
  };
24
23
  };
@@ -19,6 +19,5 @@ export const INTEGRATION_FILES = {
19
19
  },
20
20
  DEPRECATED: {
21
21
  ASSET_HANDLER: "speedKit.Asset",
22
- DEPLOYMENT_DETECTION: "deploymentDetection",
23
22
  },
24
23
  };
@@ -1,11 +1,6 @@
1
1
  import { BundleService } from "./bundle-service.js";
2
2
  export declare class BundleServiceFactory {
3
3
  private customerFolder?;
4
- private packjockelPath;
5
- /**
6
- * @param customerFolder the directory bundled code resolves its own imports from
7
- * @param packjockelPath the `PACKJOCKEL_PATH` setting; empty means the installed npm package
8
- */
9
- constructor(customerFolder?: string, packjockelPath?: string);
4
+ constructor(customerFolder?: string);
10
5
  buildService(): BundleService;
11
6
  }
@@ -1,17 +1,10 @@
1
1
  import { BundleService } from "./bundle-service.js";
2
- import { PackjockelService, resolvePackjockelBinary, } from "./packjockel-service.js";
3
2
  export class BundleServiceFactory {
4
3
  customerFolder;
5
- packjockelPath;
6
- /**
7
- * @param customerFolder the directory bundled code resolves its own imports from
8
- * @param packjockelPath the `PACKJOCKEL_PATH` setting; empty means the installed npm package
9
- */
10
- constructor(customerFolder, packjockelPath = "") {
4
+ constructor(customerFolder) {
11
5
  this.customerFolder = customerFolder;
12
- this.packjockelPath = packjockelPath;
13
6
  }
14
7
  buildService() {
15
- return new BundleService(this.customerFolder, new PackjockelService(resolvePackjockelBinary(this.packjockelPath)));
8
+ return new BundleService(this.customerFolder);
16
9
  }
17
10
  }
@@ -1,5 +1,4 @@
1
1
  import { PluginBuild, LogLevel } from "esbuild";
2
- import type { PackjockelService } from "./packjockel-service.js";
3
2
  export type BundleEntryPoints = Record<string, string>;
4
3
  export type BundleBasePaths = Record<string, string>;
5
4
  /**
@@ -9,18 +8,10 @@ export type BundleBasePaths = Record<string, string>;
9
8
  export type BundleResolveFallback = (specifier: string) => Promise<string | null>;
10
9
  export declare class BundleService {
11
10
  private moduleDiscoveryDir;
12
- private readonly packjockelService?;
13
11
  /**
14
12
  * @param moduleDiscoveryDir the directory bundled code resolves its own imports from
15
- * @param packjockelService bundles instead of esbuild for customers with the `configPlugins` feature
16
13
  */
17
- constructor(moduleDiscoveryDir: string, packjockelService?: PackjockelService);
18
- /**
19
- * The packjockel bundler for customers with the `configPlugins` feature.
20
- *
21
- * @throws ApplicationError when the service was built without one
22
- */
23
- get packjockel(): PackjockelService;
14
+ constructor(moduleDiscoveryDir: string);
24
15
  bundle({ entryPoints, basePaths, define, target, minify, logLevel, alias, platform, resolveFallback, packages, }: {
25
16
  entryPoints: BundleEntryPoints;
26
17
  basePaths?: BundleBasePaths;
@@ -4,31 +4,16 @@ import { URL } from "node:url";
4
4
  import { BundleResolveError } from "./error/bundle-resolve-error.js";
5
5
  import { BundleFetchError } from "./error/bundle-fetch-error.js";
6
6
  import { resolve } from "node:path";
7
- import ApplicationError from "../error-handling/error/application-error.js";
8
7
  const FALLBACK_NAMESPACE = "bundle-resolve-fallback";
9
8
  const RELATIVE_SPECIFIER = /^\.{1,2}\//;
10
9
  const importCache = {};
11
10
  export class BundleService {
12
11
  moduleDiscoveryDir;
13
- packjockelService;
14
12
  /**
15
13
  * @param moduleDiscoveryDir the directory bundled code resolves its own imports from
16
- * @param packjockelService bundles instead of esbuild for customers with the `configPlugins` feature
17
14
  */
18
- constructor(moduleDiscoveryDir, packjockelService) {
15
+ constructor(moduleDiscoveryDir) {
19
16
  this.moduleDiscoveryDir = moduleDiscoveryDir;
20
- this.packjockelService = packjockelService;
21
- }
22
- /**
23
- * The packjockel bundler for customers with the `configPlugins` feature.
24
- *
25
- * @throws ApplicationError when the service was built without one
26
- */
27
- get packjockel() {
28
- if (!this.packjockelService) {
29
- throw new ApplicationError("This bundler has no packjockel");
30
- }
31
- return this.packjockelService;
32
17
  }
33
18
  async bundle({ entryPoints, basePaths, define, target = "es5", minify = true, logLevel = "silent", alias = {}, platform, resolveFallback, packages = "bundle", }) {
34
19
  const plugins = [];
@@ -1,3 +1,2 @@
1
1
  export * from "./bundle-service-factory.js";
2
2
  export * from "./bundle-service.js";
3
- export * from "./packjockel-service.js";
@@ -1,3 +1,2 @@
1
1
  export * from "./bundle-service-factory.js";
2
2
  export * from "./bundle-service.js";
3
- export * from "./packjockel-service.js";
@@ -16,7 +16,6 @@ const environmentMapping = {
16
16
  ideaDirectory: "IDEA_INITIAL_DIRECTORY",
17
17
  slackToken: "SLACK_TOKEN",
18
18
  testApp: "TEST_APP",
19
- packjockelPath: "PACKJOCKEL_PATH",
20
19
  };
21
20
  const CONFIG_FILE_NAME = "config.json";
22
21
  /** Variables CI providers set besides `CI`. */
@@ -24,11 +24,6 @@ export interface CliSettings {
24
24
  ideaDirectory: string;
25
25
  slackToken: string;
26
26
  testApp: string;
27
- /**
28
- * the packjockel binary, run for customers with the `configPlugins` feature; empty means the one of
29
- * the installed `@speedkit/packjockel` package
30
- */
31
- packjockelPath: string;
32
27
  browserChannel: string;
33
28
  browserBuildId: string;
34
29
  browserAutoUpdate: boolean;
@@ -11,7 +11,6 @@ export function defaultSettings() {
11
11
  ideaDirectory: "",
12
12
  slackToken: "",
13
13
  testApp: "",
14
- packjockelPath: "",
15
14
  browserChannel: "",
16
15
  browserBuildId: "",
17
16
  browserAutoUpdate: false,
@@ -50,7 +50,7 @@ export class CustomerApprovalCheck {
50
50
  const configFile = await VirtualSpeedKitConfigFile.createRemote(speedKitConfig, this.bundler);
51
51
  const splits = [];
52
52
  for (const origin of this.customer.origins) {
53
- const result = await safe(configFile.evaluate(this.customer, origin));
53
+ const result = await safe(configFile.evaluate(this.customer.app, origin));
54
54
  if (result.success === false) {
55
55
  // An unreadable config is not proof that the split is 0, so keep the
56
56
  // approval question rather than skipping it.
@@ -1,9 +1,9 @@
1
1
  import { EntityManager } from "baqend";
2
- import { PostDeployCheckInterface } from "../../deploy-service-model.js";
2
+ import { PostDeployCheckInterface, PostDeployCheckResult } from "../../deploy-service-model.js";
3
3
  import { CliServiceInterface } from "../../../cli/index.js";
4
4
  export declare class RefreshDeploymentJobCheck implements PostDeployCheckInterface {
5
5
  private entityManager;
6
6
  private cli;
7
7
  constructor(entityManager: EntityManager, cli: CliServiceInterface);
8
- check(): Promise<void>;
8
+ check(): Promise<PostDeployCheckResult>;
9
9
  }
@@ -1,4 +1,3 @@
1
- import ApplicationError from "../../../error-handling/error/application-error.js";
2
1
  export class RefreshDeploymentJobCheck {
3
2
  entityManager;
4
3
  cli;
@@ -21,12 +20,14 @@ export class RefreshDeploymentJobCheck {
21
20
  this.cli.writeWarning(" Deployment jobs are missing. These are normally created on first deployment run.");
22
21
  }
23
22
  if (missingRequiredJobs.length > 0) {
24
- throw new ApplicationError("MISSING JOBS", [
25
- `Missing required jobs: ${missingRequiredJobs.join(", ")}`,
26
- 'To create missing jobs, follow the steps here:",\n' +
27
- ' "https://www.notion.so/baqend/How-to-create-missing-Jobs-306de49f8a9980f397c2ebe693da4aac?v=fcdbfc994dca4aa6be42228b37609d48&source=copy_link"\n' +
28
- " ",
29
- ]);
23
+ return {
24
+ success: false,
25
+ error: `Missing required jobs: ${missingRequiredJobs.join(", ")}`,
26
+ suggestions: [
27
+ "To create missing jobs, follow the steps here: https://www.notion.so/baqend/How-to-create-missing-Jobs-306de49f8a9980f397c2ebe693da4aac?v=fcdbfc994dca4aa6be42228b37609d48&source=copy_link",
28
+ ],
29
+ };
30
30
  }
31
+ return { success: true };
31
32
  }
32
33
  }
@@ -1,10 +1,10 @@
1
1
  import { CliServiceInterface } from "../../../cli/index.js";
2
- import { PostDeployCheckInterface } from "../../deploy-service-model.js";
2
+ import { PostDeployCheckInterface, PostDeployCheckResult } from "../../deploy-service-model.js";
3
3
  import { ConfigApiService } from "../../../config-api/index.js";
4
4
  export default class RevalidatedModuleCheck implements PostDeployCheckInterface {
5
5
  private readonly configApi;
6
6
  private cli;
7
7
  private readonly app;
8
8
  constructor(configApi: ConfigApiService, cli: CliServiceInterface, app: string);
9
- check(): Promise<void>;
9
+ check(): Promise<PostDeployCheckResult>;
10
10
  }
@@ -1,6 +1,5 @@
1
1
  import { safe } from "../../../../helpers/safe.js";
2
2
  import { DeployModuleFileError } from "../../error/deploy-module-file-error.js";
3
- import { CheckModuleFileError } from "../../error/check-module-file-error.js";
4
3
  const REVALIDATED_MODULE_NAME = "speedKit.Revalidated";
5
4
  export default class RevalidatedModuleCheck {
6
5
  configApi;
@@ -14,14 +13,19 @@ export default class RevalidatedModuleCheck {
14
13
  async check() {
15
14
  this.cli.startAction("POST:CHECK:REVALIDATED_MODULE", "[postDeployCheck] check for revalidated module");
16
15
  const result = await safe(this.configApi.getModule(REVALIDATED_MODULE_NAME));
17
- if (result.success === true && result.data) {
18
- this.cli.successAction("POST:CHECK:REVALIDATED_MODULE");
19
- return;
20
- }
21
- this.cli.failAction("POST:CHECK:REVALIDATED_MODULE");
22
16
  if (result.success === false) {
17
+ this.cli.failAction("POST:CHECK:REVALIDATED_MODULE");
23
18
  throw new DeployModuleFileError(result.error);
24
19
  }
25
- throw new CheckModuleFileError(`it seems ${REVALIDATED_MODULE_NAME} does not exists in the app ${this.app}`, ["please execute:", `sk generate-pop-config ${this.app}`]);
20
+ if (result.data) {
21
+ this.cli.successAction("POST:CHECK:REVALIDATED_MODULE");
22
+ return { success: true };
23
+ }
24
+ this.cli.failAction("POST:CHECK:REVALIDATED_MODULE");
25
+ return {
26
+ success: false,
27
+ error: `${REVALIDATED_MODULE_NAME} does not exist in the app ${this.app}`,
28
+ suggestions: [`sk generate-pop-config ${this.app}`],
29
+ };
26
30
  }
27
31
  }
@@ -1,12 +1,12 @@
1
1
  import { CliServiceInterface } from "../../../cli/index.js";
2
2
  import { FileListInterface, InstallResourceFile } from "../../../integration-api/index.js";
3
- import { PostDeployCheckInterface } from "../../deploy-service-model.js";
3
+ import { PostDeployCheckInterface, PostDeployCheckResult } from "../../deploy-service-model.js";
4
4
  import { DeployPolicyInterface } from "../../policy/index.js";
5
5
  export default class SaveFilesCheck implements PostDeployCheckInterface {
6
6
  private policy;
7
7
  private fileList;
8
8
  private readonly cli;
9
9
  constructor(fileList: FileListInterface, cli: CliServiceInterface, policy: DeployPolicyInterface);
10
- check(): Promise<void>;
10
+ check(): Promise<PostDeployCheckResult>;
11
11
  safeFiles(fileList: InstallResourceFile[]): Promise<void>;
12
12
  }
@@ -15,10 +15,10 @@ export default class SaveFilesCheck {
15
15
  return file.isUpdated();
16
16
  });
17
17
  if (fileList.length === 0) {
18
- return;
18
+ return { success: true };
19
19
  }
20
20
  if (!(await this.policy.confirm(DeployQuestion.SaveLocalFiles, `Changes to localFiles will be saved now. Proceed?`))) {
21
- return;
21
+ return { success: true };
22
22
  }
23
23
  this.cli.startAction("POST:DEPLOY:SAVE_FILES", "safe changed files");
24
24
  const result = await safe(this.safeFiles(fileList));
@@ -27,6 +27,7 @@ export default class SaveFilesCheck {
27
27
  throw new SafeFileError(result.error);
28
28
  }
29
29
  this.cli.successAction("POST:DEPLOY:SAVE_FILES");
30
+ return { success: true };
30
31
  }
31
32
  async safeFiles(fileList) {
32
33
  for (const file of fileList) {
@@ -61,10 +61,11 @@ export class DeviceDetectionChangedCheck {
61
61
  }
62
62
  async checkForChangedDeviceDetection(speedKitConfigFile, activeSpeedKitConfig) {
63
63
  const remoteConfigFile = await VirtualSpeedKitConfigFile.createRemote(activeSpeedKitConfig, this.bundler);
64
+ const app = this.customerConfig.app;
64
65
  const origin = this.customerConfig.origins[0];
65
66
  const changes = [];
66
- const localSpeedKit = await speedKitConfigFile.evaluate(this.customerConfig, origin);
67
- const remoteSpeedKit = await remoteConfigFile.evaluate(this.customerConfig, origin);
67
+ const localSpeedKit = await speedKitConfigFile.evaluate(app, origin);
68
+ const remoteSpeedKit = await remoteConfigFile.evaluate(app, origin);
68
69
  if ((localSpeedKit.detectDevice && !remoteSpeedKit.detectDevice) ||
69
70
  (!localSpeedKit.detectDevice && remoteSpeedKit.detectDevice)) {
70
71
  changes.push("detectDevice");
@@ -63,10 +63,11 @@ export class SplitChangeCheck {
63
63
  }
64
64
  async checkSplitsForEachOrigin(speedKitConfigFile, activeSpeedKitConfig) {
65
65
  const remoteConfigFile = await VirtualSpeedKitConfigFile.createRemote(activeSpeedKitConfig, this.bundler);
66
+ const app = this.customerConfig.app;
66
67
  const changes = [];
67
68
  for (const origin of this.customerConfig.origins) {
68
- const localSpeedKit = await speedKitConfigFile.evaluate(this.customerConfig, origin);
69
- const remoteSpeedKit = await remoteConfigFile.evaluate(this.customerConfig, origin);
69
+ const localSpeedKit = await speedKitConfigFile.evaluate(app, origin);
70
+ const remoteSpeedKit = await remoteConfigFile.evaluate(app, origin);
70
71
  // check for split change
71
72
  if (localSpeedKit.split !== remoteSpeedKit.split) {
72
73
  changes.push({
@@ -11,7 +11,6 @@ import ServerConfigHandler from "./handler/server-config-handler.js";
11
11
  import { IntegrationApiFactory, IntegrationApiServiceBuildContext, FILE_TYPE, DEFAULT_BLOCKED_FOLDERS, } from "../integration-api/index.js";
12
12
  import { SplitChangeCheck } from "./checks/pre-deploy/split-change-check.js";
13
13
  import { ConfigApiContext, ConfigApiServiceFactory, } from "../config-api/index.js";
14
- import { DeprecatedDeploymentDetectionCheck } from "./checks/post-deploy/deprecated-deployment-detection-check.js";
15
14
  import { DeviceDetectionChangedCheck } from "./checks/pre-deploy/device-detection-changed-check.js";
16
15
  import { RefreshDeploymentJobCheck } from "./checks/post-deploy/refresh-deployment-job-check.js";
17
16
  import { CustomerApprovalCheck } from "./checks/activation/customer-approval-check.js";
@@ -60,7 +59,7 @@ export default class DeployServiceFactory {
60
59
  })).getService();
61
60
  const policy = this.policyOverride ?? new InteractiveDeployPolicy(cliService);
62
61
  const installResourceBuilder = new InstallResourceBuilder(configApi);
63
- const bundler = new BundleServiceFactory("./", this.context.environment.settings.packjockelPath).buildService();
62
+ const bundler = new BundleServiceFactory("./").buildService();
64
63
  const deletedFilesChecker = new DeletedFileCheck(cliService, policy, this.context.hasArtifacts);
65
64
  this.service = new DeployService(files, [
66
65
  new CustomerConfigHandler(customer, configApi, configName, diffService, cliService, installResourceBuilder, policy),
@@ -99,7 +98,6 @@ export default class DeployServiceFactory {
99
98
  return [
100
99
  new SaveFilesCheck(files, cliService, policy),
101
100
  new RevalidatedModuleCheck(configApi, cliService, app),
102
- new DeprecatedDeploymentDetectionCheck(files, cliService, configApi, app, policy),
103
101
  new RefreshDeploymentJobCheck(await configApi.client.getEntityManager(), cliService),
104
102
  ];
105
103
  }
@@ -1,5 +1,15 @@
1
+ /**
2
+ * What a post-deploy check found. The deploy is already uploaded when the checks
3
+ * run, so a finding is reported rather than thrown; a check throws only when it
4
+ * could not do its job.
5
+ */
6
+ export interface PostDeployCheckResult {
7
+ readonly success: boolean;
8
+ readonly error?: string;
9
+ readonly suggestions?: string[];
10
+ }
1
11
  export interface PostDeployCheckInterface {
2
- check(): Promise<void>;
12
+ check(): Promise<PostDeployCheckResult>;
3
13
  }
4
14
  export interface PreDeployCheckInterface {
5
15
  check(): Promise<void>;
@@ -15,5 +15,7 @@ export default class DeployService {
15
15
  private uploadType;
16
16
  private runPreDeployChecks;
17
17
  private runPostDeployChecks;
18
+ /** Lays a result out the way oclif prints an error: message, then suggestions. */
19
+ private reportFailedPostDeployChecks;
18
20
  private filterFilesToProcess;
19
21
  }
@@ -55,9 +55,34 @@ export default class DeployService {
55
55
  }
56
56
  }
57
57
  async runPostDeployChecks() {
58
+ const failed = [];
58
59
  for (const postDeployCheck of this.postDeployChecks) {
59
- await postDeployCheck.check();
60
+ const result = await postDeployCheck.check();
61
+ if (!result.success) {
62
+ failed.push(result);
63
+ }
64
+ }
65
+ this.reportFailedPostDeployChecks(failed);
66
+ }
67
+ /** Lays a result out the way oclif prints an error: message, then suggestions. */
68
+ reportFailedPostDeployChecks(failed) {
69
+ if (failed.length === 0) {
70
+ return;
71
+ }
72
+ this.cli.spacer();
73
+ this.cli.writeWarning(`${failed.length} post-deploy check(s) failed:`);
74
+ for (const { error, suggestions = [] } of failed) {
75
+ const lines = [`› ${error}`];
76
+ if (suggestions.length === 1) {
77
+ lines.push(` Try this: ${suggestions[0]}`);
78
+ }
79
+ else if (suggestions.length > 1) {
80
+ lines.push(" Try this:", ...suggestions.map((s) => ` * ${s}`));
81
+ }
82
+ this.cli.spacer();
83
+ this.cli.writeWarning(lines.join("\n"));
60
84
  }
85
+ this.cli.spacer();
61
86
  }
62
87
  filterFilesToProcess() {
63
88
  this.fileList.filter((file) => {
@@ -63,6 +63,6 @@ export class MergeRequestDeployServiceFactory {
63
63
  whitelist: [],
64
64
  }))
65
65
  .buildService()
66
- .run()), new LiveStateCheck(diffService), new CustomerApprovalCheck(cliService, deployFactory.files.getCustomerConfig().config, policy, new BundleServiceFactory("./", this.context.environment.settings.packjockelPath).buildService()), deployFactory.configApi, deployFactory.files, deployFactory.configName, deployService);
66
+ .run()), new LiveStateCheck(diffService), new CustomerApprovalCheck(cliService, deployFactory.files.getCustomerConfig().config, policy, new BundleServiceFactory("./").buildService()), deployFactory.configApi, deployFactory.files, deployFactory.configName, deployService);
67
67
  }
68
68
  }
@@ -32,11 +32,7 @@ export declare enum DeployQuestion {
32
32
  /** Deploy although the device detection changes. */
33
33
  DeviceDetectionChange = "deviceDetectionChange",
34
34
  /** Write the content taken over from the installation to the local files. */
35
- SaveLocalFiles = "saveLocalFiles",
36
- /** Delete the job of the deprecated deployment detection. */
37
- DeleteDeprecatedJob = "deleteDeprecatedJob",
38
- /** Delete the module of the deprecated deployment detection. */
39
- DeleteDeprecatedModule = "deleteDeprecatedModule"
35
+ SaveLocalFiles = "saveLocalFiles"
40
36
  }
41
37
  export interface DeployPolicyInterface {
42
38
  /**
@@ -34,8 +34,4 @@ export var DeployQuestion;
34
34
  DeployQuestion["DeviceDetectionChange"] = "deviceDetectionChange";
35
35
  /** Write the content taken over from the installation to the local files. */
36
36
  DeployQuestion["SaveLocalFiles"] = "saveLocalFiles";
37
- /** Delete the job of the deprecated deployment detection. */
38
- DeployQuestion["DeleteDeprecatedJob"] = "deleteDeprecatedJob";
39
- /** Delete the module of the deprecated deployment detection. */
40
- DeployQuestion["DeleteDeprecatedModule"] = "deleteDeprecatedModule";
41
37
  })(DeployQuestion || (DeployQuestion = {}));
@@ -1,7 +1,6 @@
1
1
  import { expect } from "chai";
2
2
  import { describe, it } from "mocha";
3
3
  import { RefreshDeploymentJobCheck } from "../../../checks/post-deploy/refresh-deployment-job-check.js";
4
- import ApplicationError from "../../../../error-handling/error/application-error.js";
5
4
  function entityManagerWithJobs(names) {
6
5
  const jobs = names.map((name) => ({ data: { name }, type: "Refreshjob" }));
7
6
  return {
@@ -12,22 +11,16 @@ function entityManagerWithJobs(names) {
12
11
  }
13
12
  const cli = { writeWarning: () => undefined };
14
13
  async function runCheck(names) {
15
- try {
16
- await new RefreshDeploymentJobCheck(entityManagerWithJobs(names), cli).check();
17
- }
18
- catch (error) {
19
- return error;
20
- }
21
- return undefined;
14
+ return new RefreshDeploymentJobCheck(entityManagerWithJobs(names), cli).check();
22
15
  }
23
16
  describe("RefreshDeploymentJobCheck", () => {
24
17
  it("accepts jobs whose names carry a suffix", async () => {
25
18
  // As used by zeg and tectake.
26
- expect(await runCheck(["HTML", "Landing Page (RegExp)", "CSS, JS, Font"])).to.equal(undefined);
19
+ expect(await runCheck(["HTML", "Landing Page (RegExp)", "CSS, JS, Font"])).to.deep.equal({ success: true });
27
20
  });
28
21
  it("reports jobs that are missing entirely", async () => {
29
- const error = await runCheck(["HTML", "Images"]);
30
- expect(error).to.be.instanceOf(ApplicationError);
31
- expect(error.suggestions[0]).to.equal("Missing required jobs: Landing Page, CSS, JS, Font");
22
+ const result = await runCheck(["HTML", "Images"]);
23
+ expect(result.success).to.equal(false);
24
+ expect(result.error).to.equal("Missing required jobs: Landing Page, CSS, JS, Font");
32
25
  });
33
26
  });