@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 +14 -0
- package/README.md +1 -1
- package/dist/commands/generate-pop-config.js +3 -2
- package/dist/services/deploy/handler/customer-config-handler.js +2 -2
- package/dist/services/deploy/handler/install-resource-handler.js +4 -2
- package/dist/services/deploy/handler/module-handler.js +2 -2
- package/dist/services/deploy/handler/server-config-handler.js +2 -2
- package/dist/services/diff/diff-service.d.ts +5 -5
- package/dist/services/diff/diff-service.js +22 -20
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +1 -1
- package/dist/services/onboarding/dashboard/request-diff-service.d.ts +0 -1
- package/dist/services/onboarding/dashboard/request-diff-service.js +0 -6
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
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
|
@@ -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,
|
|
140
|
-
|
|
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 {
|
|
47
|
-
const origins = JSON.parse(
|
|
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 {
|
|
98
|
-
file.
|
|
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 {
|
|
36
|
-
file.setContent(
|
|
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 {
|
|
31
|
-
file.setContent(
|
|
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,
|
|
10
|
-
|
|
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
|
|
30
|
-
* @param
|
|
29
|
+
* @param firstPath
|
|
30
|
+
* @param secondPath
|
|
31
31
|
* @param skipDiffExecution
|
|
32
32
|
*/
|
|
33
|
-
executeDiff(
|
|
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,
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const diff = await this.executeDiff(
|
|
29
|
-
|
|
30
|
-
|
|
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
|
|
70
|
-
* @param
|
|
71
|
+
* @param firstPath
|
|
72
|
+
* @param secondPath
|
|
71
73
|
* @param skipDiffExecution
|
|
72
74
|
*/
|
|
73
|
-
async executeDiff(
|
|
74
|
-
let
|
|
75
|
-
let
|
|
75
|
+
async executeDiff(firstPath, secondPath, skipDiffExecution = false) {
|
|
76
|
+
let firstContent;
|
|
77
|
+
let secondContent;
|
|
76
78
|
try {
|
|
77
|
-
|
|
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
|
-
|
|
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 ${
|
|
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(
|
|
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",
|
|
110
|
-
.replace("$file2",
|
|
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 "${
|
|
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 ${
|
|
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 ${
|
|
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(
|
|
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,
|
package/oclif.manifest.json
CHANGED