gtx-cli 2.5.33 → 2.5.35
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,5 +1,17 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.5.35
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#905](https://github.com/generaltranslation/gt/pull/905) [`e73bf82`](https://github.com/generaltranslation/gt/commit/e73bf820422771a59408eb643e22ef7f99682b9f) Thanks [@brian-lou](https://github.com/brian-lou)! - Fix CLI failure handling
|
|
8
|
+
|
|
9
|
+
## 2.5.34
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#904](https://github.com/generaltranslation/gt/pull/904) [`51d412f`](https://github.com/generaltranslation/gt/commit/51d412f503bbb838daaaca47fc8165873ce1857e) Thanks [@fernando-aviles](https://github.com/fernando-aviles)! - Assign `save-local` changes to most recent download
|
|
14
|
+
|
|
3
15
|
## 2.5.33
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -7,6 +7,27 @@ import { gt } from '../utils/gt.js';
|
|
|
7
7
|
import os from 'node:os';
|
|
8
8
|
import { randomUUID } from 'node:crypto';
|
|
9
9
|
import { hashStringSync } from '../utils/hash.js';
|
|
10
|
+
const findLatestDownloadedVersion = (downloadedVersions, branchId, fileId, locale) => {
|
|
11
|
+
const versionsForFile = downloadedVersions.entries?.[branchId]?.[fileId] ?? undefined;
|
|
12
|
+
if (!versionsForFile)
|
|
13
|
+
return null;
|
|
14
|
+
let latest = null;
|
|
15
|
+
for (const [versionId, locales] of Object.entries(versionsForFile)) {
|
|
16
|
+
const entry = locales?.[locale];
|
|
17
|
+
if (!entry)
|
|
18
|
+
continue;
|
|
19
|
+
const updatedAt = entry.updatedAt
|
|
20
|
+
? Date.parse(entry.updatedAt)
|
|
21
|
+
: Number.NEGATIVE_INFINITY;
|
|
22
|
+
const latestUpdatedAt = latest?.entry.updatedAt
|
|
23
|
+
? Date.parse(latest.entry.updatedAt)
|
|
24
|
+
: Number.NEGATIVE_INFINITY;
|
|
25
|
+
if (!latest || updatedAt > latestUpdatedAt) {
|
|
26
|
+
latest = { versionId, entry };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return latest;
|
|
30
|
+
};
|
|
10
31
|
/**
|
|
11
32
|
* Collects local user edits by diffing the latest downloaded server translation version
|
|
12
33
|
* against the current local translation file, and submits the diffs upstream.
|
|
@@ -30,9 +51,10 @@ export async function collectAndSendUserEditDiffs(files, settings) {
|
|
|
30
51
|
continue;
|
|
31
52
|
if (!fs.existsSync(outputPath))
|
|
32
53
|
continue;
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
54
|
+
const latestDownloaded = findLatestDownloadedVersion(downloadedVersions, uploadedFile.branchId, uploadedFile.fileId, locale);
|
|
55
|
+
if (!latestDownloaded)
|
|
35
56
|
continue;
|
|
57
|
+
const downloadedVersion = latestDownloaded.entry;
|
|
36
58
|
// Skip if local file matches the last postprocessed content hash
|
|
37
59
|
if (downloadedVersion.postProcessHash) {
|
|
38
60
|
try {
|
|
@@ -50,7 +72,7 @@ export async function collectAndSendUserEditDiffs(files, settings) {
|
|
|
50
72
|
branchId: uploadedFile.branchId,
|
|
51
73
|
fileName: uploadedFile.fileName,
|
|
52
74
|
fileId: uploadedFile.fileId,
|
|
53
|
-
versionId:
|
|
75
|
+
versionId: latestDownloaded.versionId,
|
|
54
76
|
locale: locale,
|
|
55
77
|
outputPath,
|
|
56
78
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "2.5.
|
|
1
|
+
export declare const PACKAGE_VERSION = "2.5.35";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const PACKAGE_VERSION = '2.5.
|
|
2
|
+
export const PACKAGE_VERSION = '2.5.35';
|
|
@@ -70,7 +70,6 @@ export async function downloadTranslations(fileVersionData, jobData, branchData,
|
|
|
70
70
|
logger.error(`${chalk.red(`${pollResult.fileTracker.failed.size} file(s) failed to translate:`)}\n${Array.from(pollResult.fileTracker.failed.entries())
|
|
71
71
|
.map(([key, value]) => `- ${value.fileName}`)
|
|
72
72
|
.join('\n')}`);
|
|
73
|
-
return false;
|
|
74
73
|
}
|
|
75
74
|
if (!pollResult.success) {
|
|
76
75
|
return false;
|