@speedkit/cli 2.50.0 → 2.51.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.51.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.50.0...v2.51.0) (2024-08-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * **onboarding-service:** add support for using linked built speed-kit ([69b0e1d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/69b0e1da44f6f11bdf8b0982fadf8e532a1ca0b0))
7
+
1
8
  # [2.50.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.49.2...v2.50.0) (2024-08-08)
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.50.0 linux-x64 node-v20.16.0
24
+ @speedkit/cli/2.51.0 linux-x64 node-v20.16.0
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -37,6 +37,9 @@ const todo_collector_1 = require("./todo-collector");
37
37
  const crawler_1 = require("./virtual-orestes-app/crawler");
38
38
  const virtual_orestes_app_1 = require("./virtual-orestes-app");
39
39
  const config_api_1 = require("../config-api");
40
+ const fs = tslib_1.__importStar(require("node:fs"));
41
+ const path = tslib_1.__importStar(require("node:path"));
42
+ const static_recipe_1 = require("../integration-api/virtual/static-recipe");
40
43
  class OnboardingServiceFactory {
41
44
  context;
42
45
  cliConfig;
@@ -141,27 +144,52 @@ class OnboardingServiceFactory {
141
144
  return JSON.parse(serverConfigResult.data);
142
145
  }
143
146
  async getIntegrationFiles() {
147
+ const projectRoot = path.resolve(this.context.customerPath, "../..");
148
+ const speedKitPath = path.resolve(projectRoot, "node_modules", "speed-kit");
149
+ const speedKitBuildPath = path.resolve(speedKitPath, "dist", "speedkit");
150
+ const isSpeedKitLinked = fs.existsSync(speedKitPath);
151
+ const swPath = path.join(speedKitBuildPath, "sw.js");
152
+ const dfPath = path.join(speedKitBuildPath, "dynamic-fetcher.js");
153
+ const loaderPath = path.join(speedKitBuildPath, "snippet.js");
144
154
  const integrationApiContext = new integration_api_1.IntegrationApiContext(this.context.customerPath, this.context.configName, []);
145
155
  const integrationApi = new integration_api_1.IntegrationApiFactory(integrationApiContext, this.cliConfig).buildService();
146
156
  const externalFileReader = new integration_api_1.ExternalFileReader();
147
- return integrationApi.run([
157
+ const integrationApiArray = [
148
158
  {
159
+ name: files_1.INTEGRATION_FILES.CUSTOM.DOCUMENT_HANDLER,
160
+ recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_DOCUMENT_HANDLER_PATH, externalFileReader),
161
+ },
162
+ ];
163
+ // if speed-kit is npm-linked, use linked local files else fetch latest released sw and df
164
+ if (isSpeedKitLinked) {
165
+ console.log(`Linked Speed-Kit found in node_modules. Using built sw, df and loader.`);
166
+ integrationApiArray.push({
167
+ name: files_1.INTEGRATION_FILES.CUSTOM.SW,
168
+ recipe: new static_recipe_1.StaticRecipe(fs.readFileSync(swPath, "utf-8")),
169
+ overrideLocalFile: true,
170
+ }, {
171
+ name: files_1.INTEGRATION_FILES.CUSTOM.DYNAMIC_FETCHER,
172
+ recipe: new static_recipe_1.StaticRecipe(fs.readFileSync(dfPath, "utf-8")),
173
+ overrideLocalFile: true,
174
+ }, {
175
+ name: files_1.INTEGRATION_FILES.CUSTOM.LOADER,
176
+ recipe: new static_recipe_1.StaticRecipe(fs.readFileSync(loaderPath, "utf-8")),
177
+ overrideLocalFile: true,
178
+ });
179
+ }
180
+ else {
181
+ integrationApiArray.push({
149
182
  name: files_1.INTEGRATION_FILES.CUSTOM.SW,
150
183
  recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_SW_PATH, externalFileReader),
151
- },
152
- {
184
+ }, {
153
185
  name: files_1.INTEGRATION_FILES.CUSTOM.DYNAMIC_FETCHER,
154
186
  recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_DF_PATH, externalFileReader),
155
- },
156
- {
187
+ }, {
157
188
  name: files_1.INTEGRATION_FILES.CUSTOM.LOADER,
158
189
  recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_SNIPPET_PATH, externalFileReader),
159
- },
160
- {
161
- name: files_1.INTEGRATION_FILES.CUSTOM.DOCUMENT_HANDLER,
162
- recipe: new integration_api_1.ExternalRecipe(this.context.DEFAULT_DOCUMENT_HANDLER_PATH, externalFileReader),
163
- },
164
- ]);
190
+ });
191
+ }
192
+ return integrationApi.run(integrationApiArray);
165
193
  }
166
194
  async getUrlForTest(customerConfig, cli) {
167
195
  // Consider startup domain based on the following priority:
@@ -712,5 +712,5 @@
712
712
  ]
713
713
  }
714
714
  },
715
- "version": "2.50.0"
715
+ "version": "2.51.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.50.0",
4
+ "version": "2.51.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"