@speedkit/cli 3.31.0 → 3.31.2

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
+ ## [3.31.2](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.31.1...v3.31.2) (2026-03-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **diff:** return updatedFile instead of originalFile after diff ([4894d1b](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/4894d1bc93387665add4d85af35b93650a911103))
7
+
8
+ ## [3.31.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.31.0...v3.31.1) (2026-03-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * order of parameters for diffs ([d70e4fe](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/d70e4fe5ddf67b1a08670fe61dd5edb1c0e87f66))
14
+
1
15
  # [3.31.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v3.30.0...v3.31.0) (2026-03-03)
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/3.31.0 linux-x64 node-v20.20.0
24
+ @speedkit/cli/3.31.2 linux-x64 node-v20.20.1
25
25
  $ sk --help [COMMAND]
26
26
  USAGE
27
27
  $ sk COMMAND
@@ -136,8 +136,9 @@ class GeneratePopConfig extends core_1.Command {
136
136
  // new DiffService(cliService);
137
137
  const popPrewarmingCode = await this.createPopPrewarmingCode(config);
138
138
  const remoteConfig = await configService.getRemoteModule(moduleName);
139
- const result = await diffService.diffContent(moduleName, popPrewarmingCode, remoteConfig);
140
- const content = result.changedOrigins;
139
+ const result = await diffService.diffContent(moduleName, remoteConfig, // remoteContent
140
+ popPrewarmingCode);
141
+ const content = result.updatedFile;
141
142
  const isEqual = result.diff;
142
143
  if (isEqual) {
143
144
  cliService.write(`created config is the same as the deployed one`);
@@ -43,8 +43,8 @@ class CustomerConfigHandler {
43
43
  return;
44
44
  }
45
45
  // todo: add changedThrowable, let the handler catch and decide what to do with it
46
- const { changedOrigins } = await this.diffService.diffContent(file.name, JSON.stringify(config.origins, null, 4), JSON.stringify(installResource.origins, null, 4));
47
- const origins = JSON.parse(changedOrigins);
46
+ const { updatedFile } = await this.diffService.diffContent(file.name, JSON.stringify(config.origins, null, 4), JSON.stringify(installResource.origins, null, 4));
47
+ const origins = JSON.parse(updatedFile);
48
48
  file.updateOrigins(origins);
49
49
  if (!(await this.cli.confirm("Update origins?", true))) {
50
50
  file.skipFile();
@@ -94,8 +94,10 @@ class InstallResourceHandler {
94
94
  await this.confirm(file, true);
95
95
  return;
96
96
  }
97
- const { changedOrigins, diff } = await this.diffService.diffContent(file.name, file.getContent(), installResource[file.remoteKey]);
98
- file.setContent(changedOrigins);
97
+ const { updatedFile, diff } = await this.diffService.diffContent(file.name, // fileName
98
+ installResource[file.remoteKey], // remote file content
99
+ file.getContent());
100
+ file.setContent(updatedFile);
99
101
  if (diff) {
100
102
  this.cli.writeWarning(`skipped ${file.name} (identical with remote)`);
101
103
  file.skipFile();
@@ -32,8 +32,8 @@ class ModuleHandler {
32
32
  await this.confirm(file, true);
33
33
  continue;
34
34
  }
35
- const { changedOrigins, diff } = await this.diffService.diffContent(file.name, file.getContent(), remote);
36
- file.setContent(changedOrigins);
35
+ const { updatedFile, diff } = await this.diffService.diffContent(file.name, remote, file.getContent());
36
+ file.setContent(updatedFile);
37
37
  if (diff) {
38
38
  this.cli.writeWarning(`skipped ${file.name} (identical with remote)`);
39
39
  file.skipFile();
@@ -27,8 +27,8 @@ class ServerConfigHandler {
27
27
  const remoteConfig = JSON.parse(remote);
28
28
  // @ts-expect-error revision is unknown
29
29
  file.config.revision.version = remoteConfig.revision.version;
30
- const { changedOrigins, diff } = await this.diffService.diffContent(file.name, file.getContent(), remote);
31
- file.setContent(changedOrigins);
30
+ const { updatedFile, diff } = await this.diffService.diffContent(file.name, remote, file.getContent());
31
+ file.setContent(updatedFile);
32
32
  if (diff) {
33
33
  this.cli.writeWarning(`skipped ${file.name} (identical with remote)`);
34
34
  file.skipFile();
@@ -6,8 +6,8 @@ export declare class DiffService {
6
6
  private tempPath;
7
7
  constructor(cli: CliService, diffExecutablePath?: string, diffExecutableTemplate?: string);
8
8
  diff(localPath: string, fileName: string, temporaryContent: string): Promise<boolean>;
9
- diffContent(fileName: string, localContent: string, remoteContent: string): Promise<{
10
- changedOrigins: string;
9
+ diffContent(fileName: string, firstContent: string, secondContent: string, diffSuffix?: string[]): Promise<{
10
+ updatedFile: string;
11
11
  diff: boolean;
12
12
  }>;
13
13
  /**
@@ -26,9 +26,9 @@ export declare class DiffService {
26
26
  *
27
27
  * check if content of two files are equal
28
28
  *
29
- * @param localPath
30
- * @param remotePath
29
+ * @param firstPath
30
+ * @param secondPath
31
31
  * @param skipDiffExecution
32
32
  */
33
- executeDiff(localPath: string, remotePath: string, skipDiffExecution?: boolean): Promise<boolean>;
33
+ executeDiff(firstPath: string, secondPath: string, skipDiffExecution?: boolean): Promise<boolean>;
34
34
  }
@@ -22,12 +22,14 @@ class DiffService {
22
22
  const temporaryFilePath = await this.writeContentToTemporalFile(fileName, temporaryContent);
23
23
  return await this.executeDiff(temporaryFilePath, localPath);
24
24
  }
25
- async diffContent(fileName, localContent, remoteContent) {
26
- const temporaryLocalFilePath = await this.writeContentToTemporalFile(`${fileName}-local`, localContent);
27
- const temporaryRemoteFilePath = await this.writeContentToTemporalFile(`${fileName}-remote`, remoteContent);
28
- const diff = await this.executeDiff(temporaryLocalFilePath, temporaryRemoteFilePath);
29
- const changedFile = await (0, promises_1.readFile)(temporaryLocalFilePath, "utf-8");
30
- return { changedOrigins: changedFile, diff };
25
+ async diffContent(fileName, firstContent, secondContent, diffSuffix = ["remote", "local"]) {
26
+ const temporaryFirstFilePath = await this.writeContentToTemporalFile(`${fileName}-${diffSuffix[0]}`, firstContent);
27
+ const temporarySecondFilePath = await this.writeContentToTemporalFile(`${fileName}-${diffSuffix[1]}`, secondContent);
28
+ const diff = await this.executeDiff(temporaryFirstFilePath, temporarySecondFilePath);
29
+ // return changes made in diffView
30
+ // eg adding changes from remote to safe locally
31
+ const changedFile = await (0, promises_1.readFile)(temporarySecondFilePath, "utf-8");
32
+ return { updatedFile: changedFile, diff };
31
33
  }
32
34
  /**
33
35
  * Returns a temporal directory path.
@@ -66,15 +68,15 @@ class DiffService {
66
68
  *
67
69
  * check if content of two files are equal
68
70
  *
69
- * @param localPath
70
- * @param remotePath
71
+ * @param firstPath
72
+ * @param secondPath
71
73
  * @param skipDiffExecution
72
74
  */
73
- async executeDiff(localPath, remotePath, skipDiffExecution = false) {
74
- let localContent;
75
- let remoteContent;
75
+ async executeDiff(firstPath, secondPath, skipDiffExecution = false) {
76
+ let firstContent;
77
+ let secondContent;
76
78
  try {
77
- localContent = await promises_1.default.readFile(localPath, {
79
+ firstContent = await promises_1.default.readFile(firstPath, {
78
80
  encoding: "utf8",
79
81
  flag: "r",
80
82
  });
@@ -83,17 +85,17 @@ class DiffService {
83
85
  return false;
84
86
  }
85
87
  try {
86
- remoteContent = await promises_1.default.readFile(remotePath, {
88
+ secondContent = await promises_1.default.readFile(secondPath, {
87
89
  encoding: "utf8",
88
90
  flag: "r",
89
91
  });
90
92
  }
91
93
  catch (error) {
92
- this.cli.writeError(`Error reading remote file ${remoteContent}: ${error.message}`);
94
+ this.cli.writeError(`Error reading remote file ${secondContent}: ${error.message}`);
93
95
  return false;
94
96
  }
95
97
  // Returning if no difference
96
- if (this.isContentEqual(localContent, remoteContent)) {
98
+ if (this.isContentEqual(firstContent, secondContent)) {
97
99
  return true;
98
100
  }
99
101
  if (skipDiffExecution) {
@@ -106,8 +108,8 @@ class DiffService {
106
108
  try {
107
109
  const command = this.diffExecutableTemplate
108
110
  .replace("$exec", this.diffExecutablePath)
109
- .replace("$file1", localPath)
110
- .replace("$file2", remotePath);
111
+ .replace("$file1", firstPath)
112
+ .replace("$file2", secondPath);
111
113
  (0, node_child_process_1.execSync)(command, { stdio: "pipe" });
112
114
  }
113
115
  catch (error) {
@@ -117,7 +119,7 @@ class DiffService {
117
119
  }
118
120
  let ideaCommandAvailable;
119
121
  try {
120
- (0, node_child_process_1.execSync)(`idea diff "${localPath}" "${remotePath}"`, {
122
+ (0, node_child_process_1.execSync)(`idea diff "${firstPath}" "${secondPath}"`, {
121
123
  stdio: ["pipe", "ignore", "pipe"], // prevent output of "/bin/sh: idea: command not found"
122
124
  });
123
125
  ideaCommandAvailable = true;
@@ -129,12 +131,12 @@ class DiffService {
129
131
  if (!ideaCommandAvailable) {
130
132
  const isWindows = process.platform.startsWith("win");
131
133
  if (isWindows) {
132
- (0, node_child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${localPath} ${remotePath}`, { stdio: "pipe" });
134
+ (0, node_child_process_1.execSync)(`"%IDEA_INITIAL_DIRECTORY%\\idea" diff ${firstPath} ${secondPath}`, { stdio: "pipe" });
133
135
  }
134
136
  else {
135
137
  const ideaInitialDirectory = (0, normalize_1.unescapeSpaces)(process.env.IDEA_INITIAL_DIRECTORY ||
136
138
  os_1.DEFAULT_INTELLIJ_IDEA_PATH_MACOS);
137
- (0, node_child_process_1.execSync)(`"${ideaInitialDirectory}/idea" diff ${localPath} ${remotePath}`, { stdio: "pipe" });
139
+ (0, node_child_process_1.execSync)(`"${ideaInitialDirectory}/idea" diff ${firstPath} ${secondPath}`, { stdio: "pipe" });
138
140
  }
139
141
  }
140
142
  return false;
@@ -44,7 +44,7 @@ class DiffAgainstCurrentPage {
44
44
  this.cli.endAction(cli_1.CliActionStatus.COMPLETED);
45
45
  const remoteFilePath = await this.diffService.writeContentToTemporalFile(`remote-${variant}.html`, originHtml);
46
46
  const localFilePath = await this.diffService.writeContentToTemporalFile("current.html", currentHtml);
47
- return await this.diffService.executeDiff(localFilePath, remoteFilePath);
47
+ return await this.diffService.executeDiff(remoteFilePath, localFilePath);
48
48
  }
49
49
  }
50
50
  exports.DiffAgainstCurrentPage = DiffAgainstCurrentPage;
@@ -7,7 +7,6 @@ export declare class RequestDiffService {
7
7
  constructor(diffService: DiffService, documentHandlerRuntime: DocumentHandlerServer);
8
8
  postDiff(requestOrigin: string, url: string, parametersString: string, autoCheck?: boolean): Promise<BaqendResponse>;
9
9
  private diffLocal;
10
- private doOriginVsContentDiff;
11
10
  private fetchHtml;
12
11
  private createUrlsForDiff;
13
12
  private createBaqendResponse;
@@ -63,12 +63,6 @@ class RequestDiffService {
63
63
  const pureFilePath = await this.diffService.writeContentToTemporalFile("pure", transformedHtmlWithoutParameter);
64
64
  return await this.diffService.executeDiff(parametersFilePath, pureFilePath);
65
65
  }
66
- async doOriginVsContentDiff(url, content) {
67
- const html = await this.fetchHtml(url);
68
- const origin = await this.diffService.writeContentToTemporalFile("origin", html);
69
- const local = await this.diffService.writeContentToTemporalFile("content", content);
70
- return await this.diffService.executeDiff(local, origin);
71
- }
72
66
  async fetchHtml(url) {
73
67
  const agent = new node_https_1.Agent({
74
68
  rejectUnauthorized: false,
@@ -731,5 +731,5 @@
731
731
  ]
732
732
  }
733
733
  },
734
- "version": "3.31.0"
734
+ "version": "3.31.2"
735
735
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "3.31.0",
4
+ "version": "3.31.2",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"