@speedkit/cli 2.74.0 → 2.75.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 CHANGED
@@ -1,3 +1,10 @@
1
+ # [2.75.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.74.0...v2.75.0) (2025-01-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * **customer-config:** optimise wizard + add scoped deployments option ([23f379e](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/23f379ef48b2a831e26d958e1924894bb60007f6))
7
+
1
8
  # [2.74.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.73.1...v2.74.0) (2025-01-09)
2
9
 
3
10
 
package/README.md CHANGED
@@ -21,7 +21,7 @@ $ npm install -g @speedkit/cli
21
21
  $ sk COMMAND
22
22
  running command...
23
23
  $ sk (--version)
24
- @speedkit/cli/2.74.0 linux-x64 node-v20.18.1
24
+ @speedkit/cli/2.75.0 linux-x64 node-v20.18.1
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -23,6 +23,7 @@ export interface CustomerConfigSettings {
23
23
  appName?: string;
24
24
  production?: EnvironmentConfig;
25
25
  staging?: EnvironmentConfig;
26
+ activateScopedDeployments?: boolean;
26
27
  subRouteScope?: string;
27
28
  includeServiceWorker?: string;
28
29
  activateImageOptimisation?: boolean;
@@ -118,10 +118,10 @@ class CustomerConfigService {
118
118
  this.cli.spacer();
119
119
  }
120
120
  async getEnvironmentConfig(environmentType, defaultHost) {
121
- const host = await this.cli.prompt(`Enter ${environmentType.toUpperCase()} Host (without https://):`, {
121
+ const host = await this.cli.prompt(`[${environmentType.toUpperCase()}] Enter ${environmentType.toUpperCase()} host (without https://):`, {
122
122
  defaultAnswer: defaultHost,
123
123
  });
124
- const forceInstall = !(await this.cli.confirm(`Is the install.js already present on ${environmentType.toUpperCase()}?`, false));
124
+ const forceInstall = !(await this.cli.confirm(`[${environmentType.toUpperCase()}] Is the install.js already present on ${environmentType.toUpperCase()}?`, false));
125
125
  return {
126
126
  host,
127
127
  forceInstall,
@@ -136,12 +136,12 @@ class CustomerConfigService {
136
136
  return true;
137
137
  }
138
138
  async getConfigSettings() {
139
- let { production, staging, subRouteScope, includeServiceWorker, activateImageOptimisation, removeLazyLoading, addPreRendering, supportShadowDomInPreRendering, shadowDomCustomElementPrefix, activateRumTracking, useGATracking, useScrapingBee, withGoogleOptimize, activateCfRocketLoaderWorkaround, hasSoftNavigations, isShopify, isShopware, isSalesforce, isPlentymarkets, shopifyId, } = {};
140
- this.appName = await this.cli.prompt(`Enter SK App Name:`, {
139
+ let { production, staging, activateScopedDeployments, subRouteScope, includeServiceWorker, activateImageOptimisation, removeLazyLoading, addPreRendering, supportShadowDomInPreRendering, shadowDomCustomElementPrefix, activateRumTracking, useGATracking, useScrapingBee, withGoogleOptimize, activateCfRocketLoaderWorkaround, hasSoftNavigations, isShopify, isShopware, isSalesforce, isPlentymarkets, shopifyId, } = {};
140
+ this.appName = await this.cli.prompt(`[App Name] Enter desired SK app name:`, {
141
141
  validator: (input) => /^[\da-z]+(?:-[\da-z]+)*$/.test(input) ? "" : "No valid kebab-case",
142
142
  defaultAnswer: this.appName,
143
143
  });
144
- const selectedShopSystem = await this.cli.select("Which Shop System is in use?", Object.values(customer_config_service_model_1.ShopSystem).map((option) => ({
144
+ const selectedShopSystem = await this.cli.select("[Shop System] Which shop system is in use?", Object.values(customer_config_service_model_1.ShopSystem).map((option) => ({
145
145
  name: option,
146
146
  value: option,
147
147
  })));
@@ -162,49 +162,55 @@ class CustomerConfigService {
162
162
  isPlentymarkets = true;
163
163
  }
164
164
  }
165
- production = await this.getEnvironmentConfig(customer_config_service_model_1.EnvironmentType.PRODUCTION, `www.${this.appName}.de`);
166
165
  if (isShopify) {
167
- shopifyId = await this.cli.prompt(`Enter Shopify ID:`, {
166
+ shopifyId = await this.cli.prompt(`[Shop System] Enter the shop's Shopify ID:`, {
168
167
  defaultAnswer: this.appName,
169
168
  });
170
169
  }
171
- else {
172
- const withStaging = await this.cli.confirm(`Add Config for ${customer_config_service_model_1.EnvironmentType.STAGING.toUpperCase()} Environment?`, false);
170
+ production = await this.getEnvironmentConfig(customer_config_service_model_1.EnvironmentType.PRODUCTION, `www.${this.appName}.de`);
171
+ if (!isShopify) {
172
+ const withStaging = await this.cli.confirm(`[${customer_config_service_model_1.EnvironmentType.STAGING.toUpperCase()}] Should a ${customer_config_service_model_1.EnvironmentType.STAGING.toUpperCase()} config also be added?`, false);
173
173
  if (withStaging) {
174
- staging = await this.getEnvironmentConfig(customer_config_service_model_1.EnvironmentType.STAGING, production.host.replace("www", "stg"));
174
+ staging = await this.getEnvironmentConfig(customer_config_service_model_1.EnvironmentType.STAGING, production.host.replace("www", "staging"));
175
175
  }
176
176
  }
177
- if (await this.cli.confirm("Should SK only be active on specific sub-routes? (e.g. /de-de)", false)) {
178
- subRouteScope = await this.cli.prompt("Enter one exemplary sub-route to scope to (without leading/trailing slashes):", { defaultAnswer: "de-de" });
177
+ activateScopedDeployments = await this.cli.confirm("[Scoping] Is the shop using (locale-based) sub-routes, like e.g. /de-de, on the basis of which scoped deployments should to be activated to prevent local-based changes from triggering a global deployment job?", false);
178
+ if (activateScopedDeployments &&
179
+ (await this.cli.confirm("[Scoping] Should SK only be active on specific sub-routes? (e.g. /de-de)", false))) {
180
+ subRouteScope = await this.cli.prompt("[Scoping] Enter one exemplary sub-route to scope SK to (without leading/trailing slashes):", { defaultAnswer: "de-de" });
179
181
  }
180
- if (await this.cli.confirm("Is there a Service Worker which needs to be included?", false)) {
181
- includeServiceWorker = await this.cli.prompt("Enter path of Service Worker to be included:", { defaultAnswer: "/sw.js" });
182
+ if (await this.cli.confirm("[Service Worker] Is there a Service Worker which needs to be included?", false)) {
183
+ includeServiceWorker = await this.cli.prompt("[Service Worker] Enter path of Service Worker to be included:", { defaultAnswer: "/sw.js" });
182
184
  }
183
- activateImageOptimisation = await this.cli.confirm("Activate Image Optimisation?", false);
184
- removeLazyLoading = await this.cli.confirm("Remove Lazy-Loading?");
185
- if (await this.cli.confirm("Add Pre-Rendering? This requires a set-up Lambda function to work. Also requires usage of the DOM-based DocumentHandler.", false)) {
185
+ activateImageOptimisation = await this.cli.confirm("[IO] Should image optimisation be activated?", false);
186
+ removeLazyLoading = await this.cli.confirm("[Lazy-Loading] Does the shop require us to resolve lazy-loaded content?");
187
+ if (await this.cli.confirm("[Pre-Rendering] Add pre-rendering? This requires a set-up Lambda function to work. Also requires usage of the DOM-based DocumentHandler.", false)) {
186
188
  addPreRendering = true;
187
- if (await this.cli.confirm("Does the customer utilize Shadow DOMs? If so additional handling for this will be added.", false)) {
189
+ if (await this.cli.confirm("[Pre-Rendering] Does the customer utilize Shadow DOMs? If so additional handling for this will be added.", false)) {
188
190
  supportShadowDomInPreRendering = true;
189
- shadowDomCustomElementPrefix = await this.cli.prompt("Please specify the prefix of the custom elements used (e.g. o2 uses tef-): ", { defaultAnswer: "custom-" });
191
+ shadowDomCustomElementPrefix = await this.cli.prompt("[Pre-Rendering] Please specify the prefix of the custom elements used (e.g. o2 uses tef-): ", { defaultAnswer: "custom-" });
190
192
  }
191
193
  }
192
- useScrapingBee = await this.cli.confirm("Do customer responses differ geo-location-based (ScrapingBee will be needed to fetch documents)?", false);
193
- activateRumTracking = await this.cli.confirm("Activate RUM Tracking?");
194
- if (activateRumTracking) {
195
- if (!isShopify) {
196
- useGATracking = await this.cli.confirm("Add Tracking based on Google Analytics' DataLayer?");
197
- }
198
- hasSoftNavigations = await this.cli.confirm("Add Tracking for Soft Navigations?", false);
194
+ useScrapingBee = await this.cli.confirm("[ScrapingBee] Do customer responses differ geo-location-based which would require ScrapingBee API to fetch documents?", false);
195
+ activateRumTracking = true;
196
+ // activateRumTracking = await this.cli.confirm(
197
+ // "[Tracking] Activate RUM Tracking?",
198
+ // );
199
+ // if (activateRumTracking) {
200
+ if (!isShopify) {
201
+ useGATracking = await this.cli.confirm("[Tracking] Add tracking based on Google Analytics' DataLayer?");
199
202
  }
200
- withGoogleOptimize = await this.cli.confirm("Is Google Optimize being used?", false);
203
+ hasSoftNavigations = await this.cli.confirm("[Tracking] Add tracking for Soft Navigations?", false);
204
+ // }
205
+ withGoogleOptimize = await this.cli.confirm("[Services] Is Google Optimize used?", false);
201
206
  activateCfRocketLoaderWorkaround = isShopify
202
207
  ? true
203
- : await this.cli.confirm("Activate Workaround for Cloudflare's Rocket Loader?", false);
208
+ : await this.cli.confirm("[Services] Is Cloudflare's Rocket Loader used, for which we would need to activate a workaround?", false);
204
209
  return {
205
210
  appName: this.appName,
206
211
  production,
207
212
  staging,
213
+ activateScopedDeployments,
208
214
  subRouteScope,
209
215
  includeServiceWorker,
210
216
  activateImageOptimisation,
@@ -238,7 +244,7 @@ class CustomerConfigService {
238
244
  async generateConfig() {
239
245
  this.cli.write("\nLet's generate a config...\n");
240
246
  const configSettings = await this.getConfigSettings();
241
- const addDowntimeDetection = await this.cli.confirm("Add Downtime Detection?", false);
247
+ const addDowntimeDetection = await this.cli.confirm("[Downtime Detection] Add Downtime Detection?", false);
242
248
  if (addDowntimeDetection) {
243
249
  this.templates.push("downtimeDetection.js.hbs");
244
250
  }
@@ -121,7 +121,13 @@ const config = {
121
121
  {{else}}
122
122
  delayScriptPath: "/speed-kit-dom-ready.js",
123
123
  {{/if}}
124
+ {{#if activateScopedDeployments}}
125
+ executeDeploymentDetection: {
126
+ scope: true,
127
+ },
128
+ {{else}}
124
129
  executeDeploymentDetection: true,
130
+ {{/if}}
125
131
  {{#unless addPreRendering}}
126
132
  {{#if removeLazyLoading}}
127
133
  lazyLoadList,
@@ -712,5 +712,5 @@
712
712
  ]
713
713
  }
714
714
  },
715
- "version": "2.74.0"
715
+ "version": "2.75.0"
716
716
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "2.74.0",
4
+ "version": "2.75.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"