@speedkit/cli 2.50.0 → 2.52.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,17 @@
1
+ # [2.52.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.51.0...v2.52.0) (2024-08-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * **onboarding:** disable deploymentDetection in localMode ([b6faa9f](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/b6faa9f0bbe0a44784d929689b1fec01a25dcde2))
7
+
8
+ # [2.51.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.50.0...v2.51.0) (2024-08-09)
9
+
10
+
11
+ ### Features
12
+
13
+ * **onboarding-service:** add support for using linked built speed-kit ([69b0e1d](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/69b0e1da44f6f11bdf8b0982fadf8e532a1ca0b0))
14
+
1
15
  # [2.50.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v2.49.2...v2.50.0) (2024-08-08)
2
16
 
3
17
 
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.52.0 linux-x64 node-v20.16.0
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -18,6 +18,7 @@ export declare class DocumentHandlerServer {
18
18
  private getTransformFunctionWrapper;
19
19
  buildDocumentHandler(): Promise<void>;
20
20
  private createDocumentHandlerConfigFile;
21
+ private deactivateReleaseAndDeploymentDetection;
21
22
  private getDocumentHandler;
22
23
  private getDynamicFetcher;
23
24
  private getDynamicFetcherConfig;
@@ -90,7 +90,14 @@ class DocumentHandlerServer {
90
90
  this.cli.writeSuccess("rebuild documentHandler");
91
91
  }
92
92
  async createDocumentHandlerConfigFile() {
93
- return this.getDocumentHandlerConfig().replace("export const post", "const post");
93
+ const config = this.getDocumentHandlerConfig().replace("export const post", "const post");
94
+ return this.deactivateReleaseAndDeploymentDetection(config);
95
+ }
96
+ deactivateReleaseAndDeploymentDetection(documentHandlerConfig) {
97
+ return documentHandlerConfig.replace("const documentHandler =", (selected) => {
98
+ return (`config["executeDeploymentDetection"] = false;config["executeReleaseDetection"] = false;\n` +
99
+ selected);
100
+ });
94
101
  }
95
102
  async getDocumentHandler() {
96
103
  return this.files
@@ -131,19 +138,19 @@ class DocumentHandlerServer {
131
138
  }
132
139
  async createDataBaseMock() {
133
140
  const vmConsole = {
134
- log: (context) => {
141
+ log: (...logArguments) => {
135
142
  this.verboseLevel
136
- ? this.cli.write(`[documentHandler.dbLog]: ${JSON.stringify(context)}`)
143
+ ? this.cli.write(`[documentHandler.dbLog]: ${JSON.stringify(logArguments)}`)
137
144
  : "";
138
145
  },
139
- info: (context) => {
146
+ info: (...logArguments) => {
140
147
  this.verboseLevel
141
- ? this.cli.writeWarning(`[documentHandler.dbLog]: ${JSON.stringify(context)}`)
148
+ ? this.cli.writeWarning(`[documentHandler.dbLog]: ${JSON.stringify(logArguments)}`)
142
149
  : "";
143
150
  },
144
- error: (context) => {
151
+ error: (...logArguments) => {
145
152
  this.verboseLevel
146
- ? this.cli.writeError(`[documentHandler.dbLog]: ${JSON.stringify(context)}`)
153
+ ? this.cli.writeError(`[documentHandler.dbLog]: ${JSON.stringify(logArguments)}`)
147
154
  : "";
148
155
  },
149
156
  };
@@ -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.52.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.52.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"