gt 2.27.1 → 2.27.3
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 +18 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/generated/version.js.map +1 -1
- package/dist/workflows/download.d.ts +1 -1
- package/dist/workflows/download.js +20 -2
- package/dist/workflows/download.js.map +1 -1
- package/dist/workflows/steps/PollJobsStep.d.ts +3 -1
- package/dist/workflows/steps/PollJobsStep.js +4 -1
- package/dist/workflows/steps/PollJobsStep.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.27.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2661](https://github.com/generaltranslation/gt/pull/2661) [`b3c3647`](https://github.com/generaltranslation/gt/commit/b3c3647239a6c44c3549e722b7001b83624865f8) Thanks [@chenxin-yan](https://github.com/chenxin-yan)! - Source files over the upload route's inline limit (20MB, or more than a request can carry with their `formatMetadata`) are uploaded straight to storage, content and `formatMetadata` both, and sent by reference, so `gt stage` and `gt translate` no longer fail with 413 on large files or large source-code context. `@generaltranslation/api` adds `createFileUploads`, `putFileUpload`, and `uploadSourceFileReferences`.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`b3c3647`](https://github.com/generaltranslation/gt/commit/b3c3647239a6c44c3549e722b7001b83624865f8)]:
|
|
10
|
+
- generaltranslation@9.5.11
|
|
11
|
+
- @generaltranslation/python-extractor@0.2.66
|
|
12
|
+
- @generaltranslation/supported-locales@2.1.47
|
|
13
|
+
- @generaltranslation/vue-extractor@0.1.25
|
|
14
|
+
|
|
15
|
+
## 2.27.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#2662](https://github.com/generaltranslation/gt/pull/2662) [`bc88c3f`](https://github.com/generaltranslation/gt/commit/bc88c3f850e75d38e1459ae6ad612c1da0917813) Thanks [@pie575](https://github.com/pie575)! - Show server-provided translation failure reasons, including insufficient credit details, in CLI errors and the translation summary. Display readable inline catalog names instead of the internal template filename.
|
|
20
|
+
|
|
3
21
|
## 2.27.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "2.27.
|
|
1
|
+
export declare const PACKAGE_VERSION = "2.27.3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","names":[],"sources":["../../src/generated/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const PACKAGE_VERSION = '2.27.
|
|
1
|
+
{"version":3,"file":"version.js","names":[],"sources":["../../src/generated/version.ts"],"sourcesContent":["// This file is auto-generated. Do not edit manually.\nexport const PACKAGE_VERSION = '2.27.3';\n"],"mappings":";AACA,MAAa,kBAAkB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Settings } from '../types/index.js';
|
|
2
2
|
import { EnqueueFilesResult } from 'generaltranslation/types';
|
|
3
3
|
import { BranchData } from '../types/branch.js';
|
|
4
|
-
import type
|
|
4
|
+
import { type InlineLibrary } from '../types/libraries.js';
|
|
5
5
|
export type FileTranslationData = {
|
|
6
6
|
[fileId: string]: {
|
|
7
7
|
versionId: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { logger } from "../console/logger.js";
|
|
2
|
+
import "../utils/constants.js";
|
|
3
|
+
import { getInlineElementsLabel } from "../types/libraries.js";
|
|
2
4
|
import { logErrorAndExit } from "../console/logging.js";
|
|
3
5
|
import { branchResolutionError } from "../console/index.js";
|
|
4
6
|
import { api } from "../utils/api.js";
|
|
@@ -8,6 +10,7 @@ import { clearLocaleDirs } from "../fs/clearLocaleDirs.js";
|
|
|
8
10
|
import { PollTranslationJobsStep } from "./steps/PollJobsStep.js";
|
|
9
11
|
import { DownloadTranslationsStep } from "./steps/DownloadStep.js";
|
|
10
12
|
import chalk from "chalk";
|
|
13
|
+
import { createDiagnosticMessage } from "generaltranslation/internal";
|
|
11
14
|
import path from "node:path";
|
|
12
15
|
//#region src/workflows/download.ts
|
|
13
16
|
/**
|
|
@@ -49,8 +52,23 @@ async function runDownloadWorkflow({ fileVersionData, jobData, branchData, local
|
|
|
49
52
|
forceRetranslation
|
|
50
53
|
});
|
|
51
54
|
if (pollResult.fileTracker.failed.size > 0) {
|
|
52
|
-
|
|
53
|
-
for (const [, value] of pollResult.fileTracker.failed)
|
|
55
|
+
const failures = [];
|
|
56
|
+
for (const [, value] of pollResult.fileTracker.failed) {
|
|
57
|
+
const fileName = value.fileName === "__INTERNAL_GT_TEMPLATE_NAME__" ? `<${getInlineElementsLabel(inlineLibrary)}>` : value.fileName;
|
|
58
|
+
const reason = createDiagnosticMessage({
|
|
59
|
+
whatHappened: `Failed to translate for locale ${value.locale}`,
|
|
60
|
+
details: value.failureReason
|
|
61
|
+
});
|
|
62
|
+
failures.push(`- ${fileName}: ${reason}`);
|
|
63
|
+
recordWarning("failed_translation", fileName, reason);
|
|
64
|
+
}
|
|
65
|
+
const failureMessage = createDiagnosticMessage({
|
|
66
|
+
source: "gt",
|
|
67
|
+
severity: "Error",
|
|
68
|
+
whatHappened: `${pollResult.fileTracker.failed.size} file(s) failed to translate`,
|
|
69
|
+
details: `\n${failures.join("\n")}`
|
|
70
|
+
});
|
|
71
|
+
logger.error(failureMessage);
|
|
54
72
|
if (pollResult.fileTracker.completed.size === 0) return false;
|
|
55
73
|
}
|
|
56
74
|
if (!pollResult.success) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.js","names":[],"sources":["../../src/workflows/download.ts"],"sourcesContent":["import path from 'node:path';\nimport { Settings } from '../types/index.js';\nimport { api } from '../utils/api.js';\nimport { EnqueueFilesResult } from 'generaltranslation/types';\nimport { clearLocaleDirs } from '../fs/clearLocaleDirs.js';\nimport {\n FileStatusTracker,\n PollTranslationJobsStep,\n} from './steps/PollJobsStep.js';\nimport { DownloadTranslationsStep } from './steps/DownloadStep.js';\nimport { BranchData } from '../types/branch.js';\nimport { branchResolutionError } from '../console/index.js';\nimport { logErrorAndExit } from '../console/logging.js';\nimport { logger } from '../console/logger.js';\nimport { recordWarning } from '../state/translateWarnings.js';\nimport { BranchStep } from './steps/BranchStep.js';\nimport { FileProperties } from '../types/files.js';\nimport chalk from 'chalk';\nimport type { InlineLibrary } from '../types/libraries.js';\n\nexport type FileTranslationData = {\n [fileId: string]: {\n versionId: string;\n fileName: string;\n /** Source component count for GTJSON files */\n componentCount?: number;\n };\n};\n\n/**\n * Checks the status of translations and downloads them using a workflow pattern\n * @param fileVersionData - Mapping of file IDs to their version and name information\n * @param jobData - Optional job data from enqueue operation\n * @param locales - The locales to wait for\n * @param timeoutDuration - The timeout duration for the wait in seconds\n * @param resolveOutputPath - Function to resolve the output path for a given source path and locale\n * @param options - Settings configuration\n * @param forceRetranslation - Whether to force retranslation\n * @param forceDownload - Whether to force download even if file exists\n * @returns True if all translations are downloaded successfully, false otherwise\n */\nexport async function runDownloadWorkflow({\n fileVersionData,\n jobData,\n branchData,\n locales,\n timeoutDuration,\n resolveOutputPath,\n options,\n inlineLibrary,\n forceRetranslation,\n forceDownload,\n}: {\n fileVersionData: FileTranslationData;\n jobData: EnqueueFilesResult | undefined;\n branchData: BranchData | undefined;\n locales: string[];\n timeoutDuration: number;\n resolveOutputPath: (sourcePath: string, locale: string) => string | null;\n options: Settings;\n inlineLibrary?: InlineLibrary;\n forceRetranslation?: boolean;\n forceDownload?: boolean;\n}): Promise<boolean> {\n if (!branchData) {\n // Run the branch step\n const branchStep = new BranchStep(api, options);\n const branchResult = await branchStep.run();\n if (!branchResult) {\n return logErrorAndExit(branchResolutionError);\n }\n branchData = branchResult;\n }\n // readLockfile uses _branchId to select branch-specific lockfile entries.\n // Keep it on a scoped copy so the caller's settings object is not mutated.\n const settingsForBranch: Settings = {\n ...options,\n _branchId: branchData.currentBranch.id,\n };\n // Prepare the query data\n const fileQueryData = prepareFileQueryData(\n fileVersionData,\n locales,\n branchData\n );\n\n // Initialize download status\n const fileTracker: FileStatusTracker = {\n completed: new Map<string, FileProperties>(),\n inProgress: new Map<string, FileProperties>(),\n failed: new Map<string, FileProperties>(),\n skipped: new Map<string, FileProperties>(),\n };\n\n // Step 1: Poll translation jobs if jobData exists\n let pollTimedOut = false;\n if (jobData) {\n const pollStep = new PollTranslationJobsStep(api, inlineLibrary);\n const pollResult = await pollStep.run({\n fileTracker,\n fileQueryData,\n jobData,\n timeoutDuration,\n forceRetranslation,\n });\n\n if (pollResult.fileTracker.failed.size > 0) {\n logger.error(\n `${chalk.red(`${pollResult.fileTracker.failed.size} file(s) failed to translate:`)}\\n${Array.from(\n pollResult.fileTracker.failed.entries()\n )\n .map(([, value]) => `- ${value.fileName}`)\n .join('\\n')}`\n );\n for (const [, value] of pollResult.fileTracker.failed) {\n recordWarning(\n 'failed_translation',\n value.fileName,\n `Failed to translate for locale ${value.locale}`\n );\n }\n\n // If all files failed translation, exit early\n if (pollResult.fileTracker.completed.size === 0) {\n return false;\n }\n }\n\n // Even if polling timed out, still download whatever completed successfully\n if (!pollResult.success) {\n pollTimedOut = true;\n if (pollResult.fileTracker.completed.size > 0) {\n logger.warn(\n chalk.yellow(\n `Timed out, but ${pollResult.fileTracker.completed.size} translation(s) completed successfully. Downloading completed files...`\n )\n );\n } else {\n return false;\n }\n }\n } else {\n for (const file of fileQueryData) {\n // Staging - assume all files are completed\n fileTracker.completed.set(\n `${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`,\n file\n );\n }\n }\n\n await clearCompletedLocaleDirs({\n fileTracker,\n locales,\n resolveOutputPath,\n options,\n });\n\n // Step 2: Download translations\n const downloadStep = new DownloadTranslationsStep(\n api,\n settingsForBranch,\n inlineLibrary\n );\n const downloadResult = await downloadStep.run({\n fileTracker,\n resolveOutputPath,\n forceDownload,\n });\n\n // If polling timed out, report failure even though we downloaded what we could\n if (pollTimedOut) {\n return false;\n }\n\n return downloadResult;\n}\n\nasync function clearCompletedLocaleDirs({\n fileTracker,\n locales,\n resolveOutputPath,\n options,\n}: {\n fileTracker: FileStatusTracker;\n locales: string[];\n resolveOutputPath: (sourcePath: string, locale: string) => string | null;\n options: Settings;\n}): Promise<void> {\n if (\n options.options?.experimentalClearLocaleDirs !== true ||\n fileTracker.completed.size === 0\n ) {\n return;\n }\n\n const translatedFiles = new Set(\n Array.from(fileTracker.completed.values())\n .map((file) => {\n const outputPath = resolveOutputPath(file.fileName, file.locale);\n // Only clear if the output path is different from the source.\n return outputPath !== null && outputPath !== file.fileName\n ? outputPath\n : null;\n })\n .filter((filePath): filePath is string => filePath !== null)\n );\n\n if (translatedFiles.size === 0) return;\n\n const cwd = path.dirname(options.config);\n\n await clearLocaleDirs(\n translatedFiles,\n locales,\n options.options?.clearLocaleDirsExclude,\n cwd\n );\n}\n\n/**\n * Prepares the file query data from input data and locales\n */\nfunction prepareFileQueryData(\n fileVersionData: FileTranslationData,\n locales: string[],\n branchData: BranchData\n): FileProperties[] {\n const fileQueryData: FileProperties[] = [];\n\n for (const fileId in fileVersionData) {\n for (const locale of locales) {\n fileQueryData.push({\n versionId: fileVersionData[fileId].versionId,\n fileName: fileVersionData[fileId].fileName,\n fileId,\n locale,\n branchId: branchData.currentBranch.id,\n componentCount: fileVersionData[fileId].componentCount,\n });\n }\n }\n\n return fileQueryData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyCA,eAAsB,oBAAoB,EACxC,iBACA,SACA,YACA,SACA,iBACA,mBACA,SACA,eACA,oBACA,iBAYmB;AACnB,KAAI,CAAC,YAAY;EAGf,MAAM,eAAe,MAAM,IADJ,WAAW,KAAK,QACF,CAAC,KAAK;AAC3C,MAAI,CAAC,aACH,QAAO,gBAAgB,sBAAsB;AAE/C,eAAa;;CAIf,MAAM,oBAA8B;EAClC,GAAG;EACH,WAAW,WAAW,cAAc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KACE,QAAQ,SAAS,gCAAgC,QACjD,YAAY,UAAU,SAAS,EAE/B;CAGF,MAAM,kBAAkB,IAAI,IAC1B,MAAM,KAAK,YAAY,UAAU,QAAQ,CAAC,CACvC,KAAK,SAAS;EACb,MAAM,aAAa,kBAAkB,KAAK,UAAU,KAAK,OAAO;AAEhE,SAAO,eAAe,QAAQ,eAAe,KAAK,WAC9C,aACA;GACJ,CACD,QAAQ,aAAiC,aAAa,KAAK,CAC/D;AAED,KAAI,gBAAgB,SAAS,EAAG;CAEhC,MAAM,MAAM,KAAK,QAAQ,QAAQ,OAAO;AAExC,OAAM,gBACJ,iBACA,SACA,QAAQ,SAAS,wBACjB,IACD;;;;;AAMH,SAAS,qBACP,iBACA,SACA,YACkB;CAClB,MAAM,gBAAkC,EAAE;AAE1C,MAAK,MAAM,UAAU,gBACnB,MAAK,MAAM,UAAU,QACnB,eAAc,KAAK;EACjB,WAAW,gBAAgB,QAAQ;EACnC,UAAU,gBAAgB,QAAQ;EAClC;EACA;EACA,UAAU,WAAW,cAAc;EACnC,gBAAgB,gBAAgB,QAAQ;EACzC,CAAC;AAIN,QAAO"}
|
|
1
|
+
{"version":3,"file":"download.js","names":[],"sources":["../../src/workflows/download.ts"],"sourcesContent":["import path from 'node:path';\nimport { createDiagnosticMessage } from 'generaltranslation/internal';\nimport { Settings } from '../types/index.js';\nimport { api } from '../utils/api.js';\nimport { EnqueueFilesResult } from 'generaltranslation/types';\nimport { clearLocaleDirs } from '../fs/clearLocaleDirs.js';\nimport {\n FileStatusTracker,\n PollTranslationJobsStep,\n} from './steps/PollJobsStep.js';\nimport { DownloadTranslationsStep } from './steps/DownloadStep.js';\nimport { BranchData } from '../types/branch.js';\nimport { branchResolutionError } from '../console/index.js';\nimport { logErrorAndExit } from '../console/logging.js';\nimport { logger } from '../console/logger.js';\nimport { recordWarning } from '../state/translateWarnings.js';\nimport { BranchStep } from './steps/BranchStep.js';\nimport { FileProperties } from '../types/files.js';\nimport chalk from 'chalk';\nimport {\n getInlineElementsLabel,\n type InlineLibrary,\n} from '../types/libraries.js';\nimport { TEMPLATE_FILE_NAME } from '../utils/constants.js';\n\nexport type FileTranslationData = {\n [fileId: string]: {\n versionId: string;\n fileName: string;\n /** Source component count for GTJSON files */\n componentCount?: number;\n };\n};\n\n/**\n * Checks the status of translations and downloads them using a workflow pattern\n * @param fileVersionData - Mapping of file IDs to their version and name information\n * @param jobData - Optional job data from enqueue operation\n * @param locales - The locales to wait for\n * @param timeoutDuration - The timeout duration for the wait in seconds\n * @param resolveOutputPath - Function to resolve the output path for a given source path and locale\n * @param options - Settings configuration\n * @param forceRetranslation - Whether to force retranslation\n * @param forceDownload - Whether to force download even if file exists\n * @returns True if all translations are downloaded successfully, false otherwise\n */\nexport async function runDownloadWorkflow({\n fileVersionData,\n jobData,\n branchData,\n locales,\n timeoutDuration,\n resolveOutputPath,\n options,\n inlineLibrary,\n forceRetranslation,\n forceDownload,\n}: {\n fileVersionData: FileTranslationData;\n jobData: EnqueueFilesResult | undefined;\n branchData: BranchData | undefined;\n locales: string[];\n timeoutDuration: number;\n resolveOutputPath: (sourcePath: string, locale: string) => string | null;\n options: Settings;\n inlineLibrary?: InlineLibrary;\n forceRetranslation?: boolean;\n forceDownload?: boolean;\n}): Promise<boolean> {\n if (!branchData) {\n // Run the branch step\n const branchStep = new BranchStep(api, options);\n const branchResult = await branchStep.run();\n if (!branchResult) {\n return logErrorAndExit(branchResolutionError);\n }\n branchData = branchResult;\n }\n // readLockfile uses _branchId to select branch-specific lockfile entries.\n // Keep it on a scoped copy so the caller's settings object is not mutated.\n const settingsForBranch: Settings = {\n ...options,\n _branchId: branchData.currentBranch.id,\n };\n // Prepare the query data\n const fileQueryData = prepareFileQueryData(\n fileVersionData,\n locales,\n branchData\n );\n\n // Initialize download status\n const fileTracker: FileStatusTracker = {\n completed: new Map<string, FileProperties>(),\n inProgress: new Map<string, FileProperties>(),\n failed: new Map<string, FileProperties>(),\n skipped: new Map<string, FileProperties>(),\n };\n\n // Step 1: Poll translation jobs if jobData exists\n let pollTimedOut = false;\n if (jobData) {\n const pollStep = new PollTranslationJobsStep(api, inlineLibrary);\n const pollResult = await pollStep.run({\n fileTracker,\n fileQueryData,\n jobData,\n timeoutDuration,\n forceRetranslation,\n });\n\n if (pollResult.fileTracker.failed.size > 0) {\n const failures: string[] = [];\n for (const [, value] of pollResult.fileTracker.failed) {\n const fileName =\n value.fileName === TEMPLATE_FILE_NAME\n ? `<${getInlineElementsLabel(inlineLibrary)}>`\n : value.fileName;\n const reason = createDiagnosticMessage({\n whatHappened: `Failed to translate for locale ${value.locale}`,\n details: value.failureReason,\n });\n failures.push(`- ${fileName}: ${reason}`);\n recordWarning('failed_translation', fileName, reason);\n }\n const failureMessage = createDiagnosticMessage({\n source: 'gt',\n severity: 'Error',\n whatHappened: `${pollResult.fileTracker.failed.size} file(s) failed to translate`,\n details: `\\n${failures.join('\\n')}`,\n });\n logger.error(failureMessage);\n\n // If all files failed translation, exit early\n if (pollResult.fileTracker.completed.size === 0) {\n return false;\n }\n }\n\n // Even if polling timed out, still download whatever completed successfully\n if (!pollResult.success) {\n pollTimedOut = true;\n if (pollResult.fileTracker.completed.size > 0) {\n logger.warn(\n chalk.yellow(\n `Timed out, but ${pollResult.fileTracker.completed.size} translation(s) completed successfully. Downloading completed files...`\n )\n );\n } else {\n return false;\n }\n }\n } else {\n for (const file of fileQueryData) {\n // Staging - assume all files are completed\n fileTracker.completed.set(\n `${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`,\n file\n );\n }\n }\n\n await clearCompletedLocaleDirs({\n fileTracker,\n locales,\n resolveOutputPath,\n options,\n });\n\n // Step 2: Download translations\n const downloadStep = new DownloadTranslationsStep(\n api,\n settingsForBranch,\n inlineLibrary\n );\n const downloadResult = await downloadStep.run({\n fileTracker,\n resolveOutputPath,\n forceDownload,\n });\n\n // If polling timed out, report failure even though we downloaded what we could\n if (pollTimedOut) {\n return false;\n }\n\n return downloadResult;\n}\n\nasync function clearCompletedLocaleDirs({\n fileTracker,\n locales,\n resolveOutputPath,\n options,\n}: {\n fileTracker: FileStatusTracker;\n locales: string[];\n resolveOutputPath: (sourcePath: string, locale: string) => string | null;\n options: Settings;\n}): Promise<void> {\n if (\n options.options?.experimentalClearLocaleDirs !== true ||\n fileTracker.completed.size === 0\n ) {\n return;\n }\n\n const translatedFiles = new Set(\n Array.from(fileTracker.completed.values())\n .map((file) => {\n const outputPath = resolveOutputPath(file.fileName, file.locale);\n // Only clear if the output path is different from the source.\n return outputPath !== null && outputPath !== file.fileName\n ? outputPath\n : null;\n })\n .filter((filePath): filePath is string => filePath !== null)\n );\n\n if (translatedFiles.size === 0) return;\n\n const cwd = path.dirname(options.config);\n\n await clearLocaleDirs(\n translatedFiles,\n locales,\n options.options?.clearLocaleDirsExclude,\n cwd\n );\n}\n\n/**\n * Prepares the file query data from input data and locales\n */\nfunction prepareFileQueryData(\n fileVersionData: FileTranslationData,\n locales: string[],\n branchData: BranchData\n): FileProperties[] {\n const fileQueryData: FileProperties[] = [];\n\n for (const fileId in fileVersionData) {\n for (const locale of locales) {\n fileQueryData.push({\n versionId: fileVersionData[fileId].versionId,\n fileName: fileVersionData[fileId].fileName,\n fileId,\n locale,\n branchId: branchData.currentBranch.id,\n componentCount: fileVersionData[fileId].componentCount,\n });\n }\n }\n\n return fileQueryData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,eAAsB,oBAAoB,EACxC,iBACA,SACA,YACA,SACA,iBACA,mBACA,SACA,eACA,oBACA,iBAYmB;AACnB,KAAI,CAAC,YAAY;EAGf,MAAM,eAAe,MAAM,IADJ,WAAW,KAAK,QACF,CAAC,KAAK;AAC3C,MAAI,CAAC,aACH,QAAO,gBAAgB,sBAAsB;AAE/C,eAAa;;CAIf,MAAM,oBAA8B;EAClC,GAAG;EACH,WAAW,WAAW,cAAc;EACrC;CAED,MAAM,gBAAgB,qBACpB,iBACA,SACA,WACD;CAGD,MAAM,cAAiC;EACrC,2B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EAC5C;EACA;EACA;EACD,CAAC;AAGF,KAAI,aACF,QAAO;AAGT,QAAO;;AAGT,eAAe,yBAAyB,EACtC,aACA,SACA,mBACA,WAMgB;AAChB,KACE,QAAQ,SAAS,gCAAgC,QACjD,YAAY,UAAU,SAAS,EAE/B;CAGF,MAAM,kBAAkB,IAAI,IAC1B,MAAM,KAAK,YAAY,UAAU,QAAQ,CAAC,CACvC,KAAK,SAAS;EACb,MAAM,aAAa,kBAAkB,KAAK,UAAU,KAAK,OAAO;AAEhE,SAAO,eAAe,QAAQ,eAAe,KAAK,WAC9C,aACA;GACJ,CACD,QAAQ,aAAiC,aAAa,KAAK,CAC/D;AAED,KAAI,gBAAgB,SAAS,EAAG;CAEhC,MAAM,MAAM,KAAK,QAAQ,QAAQ,OAAO;AAExC,OAAM,gBACJ,iBACA,SACA,QAAQ,SAAS,wBACjB,IACD;;;;;AAMH,SAAS,qBACP,iBACA,SACA,YACkB;CAClB,MAAM,gBAAkC,EAAE;AAE1C,MAAK,MAAM,UAAU,gBACnB,MAAK,MAAM,UAAU,QACnB,eAAc,KAAK;EACjB,WAAW,gBAAgB,QAAQ;EACnC,UAAU,gBAAgB,QAAQ;EAClC;EACA;EACA,UAAU,WAAW,cAAc;EACnC,gBAAgB,gBAAgB,QAAQ;EACzC,CAAC;AAIN,QAAO"}
|
|
@@ -12,7 +12,9 @@ export type PollJobsInput = {
|
|
|
12
12
|
export type FileStatusTracker = {
|
|
13
13
|
completed: Map<string, FileProperties>;
|
|
14
14
|
inProgress: Map<string, FileProperties>;
|
|
15
|
-
failed: Map<string, FileProperties
|
|
15
|
+
failed: Map<string, FileProperties & {
|
|
16
|
+
failureReason?: string;
|
|
17
|
+
}>;
|
|
16
18
|
skipped: Map<string, FileProperties>;
|
|
17
19
|
};
|
|
18
20
|
export type PollJobsOutput = {
|
|
@@ -70,7 +70,10 @@ var PollTranslationJobsStep = class {
|
|
|
70
70
|
const fileProperties = filePropertiesMap.get(fileKey);
|
|
71
71
|
if (!fileProperties) continue;
|
|
72
72
|
if (job.status === "completed") fileTracker.completed.set(fileKey, fileProperties);
|
|
73
|
-
else if (job.status === "failed") fileTracker.failed.set(fileKey,
|
|
73
|
+
else if (job.status === "failed") fileTracker.failed.set(fileKey, {
|
|
74
|
+
...fileProperties,
|
|
75
|
+
failureReason: job.error?.message ?? void 0
|
|
76
|
+
});
|
|
74
77
|
else if (job.status === "unknown") fileTracker.skipped.set(fileKey, fileProperties);
|
|
75
78
|
else continue;
|
|
76
79
|
fileTracker.inProgress.delete(fileKey);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PollJobsStep.js","names":[],"sources":["../../../src/workflows/steps/PollJobsStep.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { JobResult } from 'generaltranslation/api';\nimport { logger } from '../../console/logger.js';\nimport type { ApiClient } from '../../utils/api.js';\nimport { EnqueueFilesResult } from 'generaltranslation/types';\nimport { TEMPLATE_FILE_NAME } from '../../utils/constants.js';\nimport type { FileProperties } from '../../types/files.js';\nimport {\n getFileTranslationKey,\n queryCompletedTranslationKeys,\n} from '../utils/queryCompletedTranslations.js';\nimport {\n getInlineElementsLabel,\n type InlineLibrary,\n} from '../../types/libraries.js';\n\nexport type PollJobsInput = {\n fileTracker: FileStatusTracker;\n fileQueryData: FileProperties[];\n jobData: EnqueueFilesResult;\n timeoutDuration: number;\n forceRetranslation?: boolean;\n};\n\nexport type FileStatusTracker = {\n completed: Map<string, FileProperties>;\n inProgress: Map<string, FileProperties>;\n failed: Map<string, FileProperties>;\n skipped: Map<string, FileProperties>;\n};\n\nexport type PollJobsOutput = {\n success: boolean;\n fileTracker: FileStatusTracker;\n};\n\nexport class PollTranslationJobsStep {\n private spinner: ReturnType<typeof logger.createProgressBar> | null = null;\n private previousProgress = 0;\n\n constructor(\n private api: ApiClient,\n private inlineLibrary?: InlineLibrary\n ) {}\n\n async run({\n fileTracker,\n fileQueryData,\n jobData,\n timeoutDuration,\n forceRetranslation,\n }: PollJobsInput): Promise<PollJobsOutput> {\n const startTime = Date.now();\n this.spinner = logger.createProgressBar(fileQueryData.length);\n const spinnerMessage = forceRetranslation\n ? 'Waiting for retranslation...'\n : 'Waiting for translation...';\n this.spinner.start(spinnerMessage);\n\n // Build a map of branchId:fileId:versionId:locale -> FileProperties\n const filePropertiesMap = new Map<string, FileProperties>();\n fileQueryData.forEach((item) => {\n filePropertiesMap.set(getFileTranslationKey(item), item);\n });\n\n // Initial query to check which files already have translations\n // Skip when force retranslation is enabled, since the server\n // no longer marks force-retranslated files as incomplete\n if (!forceRetranslation) {\n const completedKeys = await queryCompletedTranslationKeys(\n this.api,\n fileQueryData\n );\n\n completedKeys.forEach((fileKey) => {\n const fileProperties = filePropertiesMap.get(fileKey);\n if (fileProperties) {\n fileTracker.completed.set(fileKey, fileProperties);\n }\n });\n }\n\n // Build a map of jobs for quick lookup:\n // branchId:fileId:versionId:locale -> job\n const jobMap = new Map<\n string,\n (typeof jobData.jobData)[number] & { jobId: string }\n >();\n Object.entries(jobData.jobData).forEach(([jobId, job]) => {\n const jobLocale = this.api.resolveAliasLocale(job.targetLocale);\n const key = `${job.branchId}:${job.fileId}:${job.versionId}:${jobLocale}`;\n jobMap.set(key, { ...job, jobId, targetLocale: jobLocale });\n });\n\n // Build a map of jobs for quick lookup:\n // jobId -> file data for the job\n const jobFileMap = new Map<\n string,\n {\n branchId: string;\n fileId: string;\n versionId: string;\n locale: string;\n }\n >();\n Object.entries(jobData.jobData).forEach(([jobId, job]) => {\n const jobLocale = this.api.resolveAliasLocale(job.targetLocale);\n jobFileMap.set(jobId, {\n branchId: job.branchId,\n fileId: job.fileId,\n versionId: job.versionId,\n locale: jobLocale,\n });\n });\n\n // Categorize each file query item\n for (const item of fileQueryData) {\n const fileKey = getFileTranslationKey(item);\n\n // Check if translation already exists (completedAt is truthy)\n const existingTranslation = fileTracker.completed.get(fileKey);\n\n if (existingTranslation) {\n continue;\n }\n\n // Check if there's a job for this file\n const jobKey = `${item.branchId}:${item.fileId}:${item.versionId}:${item.locale}`;\n const job = jobMap.get(jobKey);\n\n if (job) {\n // Job exists - mark as in progress initially\n fileTracker.inProgress.set(fileKey, item);\n } else {\n // No job and no existing translation - mark as skipped\n fileTracker.skipped.set(fileKey, item);\n }\n }\n\n // Update spinner with initial status\n this.updateSpinner(fileTracker, fileQueryData);\n\n // If force retranslation, don't skip the initial check\n if (!forceRetranslation) {\n // Check if all jobs are already complete\n if (fileTracker.inProgress.size === 0) {\n this.spinner.stop(chalk.green('All translations ready'));\n return { success: true, fileTracker };\n }\n }\n\n const timeoutSeconds = Math.max(\n 0,\n timeoutDuration - (Date.now() - startTime) / 1000\n );\n\n // onPoll receives raw statuses and result.jobs normalized ones; only the\n // shared fields are read here.\n const updateJobStatuses = (\n statuses: readonly Pick<JobResult, 'jobId' | 'status'>[]\n ) => {\n for (const job of statuses) {\n const jobFileProperties = jobFileMap.get(job.jobId);\n if (!jobFileProperties) continue;\n\n const fileKey = `${jobFileProperties.branchId}:${jobFileProperties.fileId}:${jobFileProperties.versionId}:${jobFileProperties.locale}`;\n const fileProperties = filePropertiesMap.get(fileKey);\n if (!fileProperties) continue;\n\n if (job.status === 'completed') {\n fileTracker.completed.set(fileKey, fileProperties);\n } else if (job.status === 'failed') {\n fileTracker.failed.set(fileKey, fileProperties);\n } else if (job.status === 'unknown') {\n fileTracker.skipped.set(fileKey, fileProperties);\n } else {\n continue;\n }\n fileTracker.inProgress.delete(fileKey);\n jobFileMap.delete(job.jobId);\n }\n this.updateSpinner(fileTracker, fileQueryData);\n };\n\n try {\n const result = await this.api.awaitJobs([...jobFileMap.keys()], {\n pollingIntervalSeconds: 5,\n timeoutSeconds,\n onPoll: updateJobStatuses,\n });\n if (result.complete) updateJobStatuses(result.jobs);\n } catch (error) {\n this.spinner.stop(chalk.red('Error checking translation job status'));\n throw error;\n }\n\n if (fileTracker.inProgress.size === 0) {\n this.spinner.stop(chalk.green('Translation jobs finished'));\n return { success: true, fileTracker };\n }\n\n this.spinner.stop(chalk.red('Timed out waiting for translation jobs'));\n return { success: false, fileTracker };\n }\n\n private updateSpinner(\n fileTracker: FileStatusTracker,\n fileQueryData: FileProperties[]\n ): void {\n if (!this.spinner) return;\n\n const statusText = this.generateStatusSuffixText(\n fileTracker,\n fileQueryData\n );\n const currentProgress =\n fileTracker.completed.size +\n fileTracker.failed.size +\n fileTracker.skipped.size;\n const progressDelta = currentProgress - this.previousProgress;\n this.spinner.advance(progressDelta, statusText);\n this.previousProgress = currentProgress;\n }\n\n private generateStatusSuffixText(\n fileTracker: FileStatusTracker,\n fileQueryData: FileProperties[]\n ): string {\n // Simple progress indicator\n const progressText = `${chalk.green(\n `[${\n fileTracker.completed.size +\n fileTracker.failed.size +\n fileTracker.skipped.size\n }/${fileQueryData.length}]`\n )} translations completed`;\n\n // Get terminal height to adapt our output\n const terminalHeight = process.stdout.rows || 24;\n\n // If terminal is very small, just show the basic progress\n if (terminalHeight < 6) {\n return progressText;\n }\n\n const newSuffixText = [progressText];\n\n // Organize data by filename : locale\n const fileStatus = new Map<\n string,\n {\n completed: Set<string>;\n pending: Set<string>;\n failed: Set<string>;\n skipped: Set<string>;\n }\n >();\n\n // Initialize with all files and locales from fileQueryData\n for (const item of fileQueryData) {\n if (!fileStatus.has(item.fileName)) {\n fileStatus.set(item.fileName, {\n completed: new Set(),\n pending: new Set([item.locale]),\n failed: new Set(),\n skipped: new Set(),\n });\n } else {\n fileStatus.get(item.fileName)?.pending.add(item.locale);\n }\n }\n\n // Mark which ones are completed, failed, or skipped\n for (const [_, fileProperties] of fileTracker.completed) {\n const { fileName, locale } = fileProperties;\n const status = fileStatus.get(fileName);\n if (status) {\n status.pending.delete(locale);\n status.completed.add(locale);\n }\n }\n\n for (const [_, fileProperties] of fileTracker.failed) {\n const { fileName, locale } = fileProperties;\n const status = fileStatus.get(fileName);\n if (status) {\n status.pending.delete(locale);\n status.failed.add(locale);\n }\n }\n\n for (const [_, fileProperties] of fileTracker.skipped) {\n const { fileName, locale } = fileProperties;\n const status = fileStatus.get(fileName);\n if (status) {\n status.pending.delete(locale);\n status.skipped.add(locale);\n }\n }\n\n // Calculate how many files we can show based on terminal height\n const filesArray = Array.from(fileStatus.entries());\n const maxFilesToShow = Math.min(\n filesArray.length,\n terminalHeight - 3 // Header + progress + buffer\n );\n\n // Display each file with its status on a single line\n for (let i = 0; i < maxFilesToShow; i++) {\n const [fileName, status] = filesArray[i];\n\n // Create condensed locale status\n const localeStatuses: { locale: string; status: string }[] = [];\n\n // Add completed locales (green)\n if (status.completed.size > 0) {\n localeStatuses.push(\n ...Array.from(status.completed).map((locale) => ({\n locale,\n status: 'completed',\n }))\n );\n }\n\n // Add skipped locales (green)\n if (status.skipped.size > 0) {\n localeStatuses.push(\n ...Array.from(status.skipped).map((locale) => ({\n locale,\n status: 'skipped',\n }))\n );\n }\n\n // Add failed locales (red)\n if (status.failed.size > 0) {\n localeStatuses.push(\n ...Array.from(status.failed).map((locale) => ({\n locale,\n status: 'failed',\n }))\n );\n }\n\n // Add pending locales (yellow)\n if (status.pending.size > 0) {\n localeStatuses.push(\n ...Array.from(status.pending).map((locale) => ({\n locale,\n status: 'pending',\n }))\n );\n }\n\n // Sort localeStatuses by locale\n localeStatuses.sort((a, b) => a.locale.localeCompare(b.locale));\n\n // Add colors\n const localeString = localeStatuses\n .map((locale) => {\n if (locale.status === 'completed') {\n return chalk.green(locale.locale);\n } else if (locale.status === 'skipped') {\n return chalk.gray(locale.locale);\n } else if (locale.status === 'failed') {\n return chalk.red(locale.locale);\n } else if (locale.status === 'pending') {\n return chalk.yellow(locale.locale);\n }\n })\n .join(', ');\n\n // Format the line\n const prettyFileName =\n fileName === TEMPLATE_FILE_NAME\n ? `<${getInlineElementsLabel(this.inlineLibrary)}>`\n : fileName;\n newSuffixText.push(`${chalk.bold(prettyFileName)} [${localeString}]`);\n }\n\n // If we couldn't show all files, add an indicator\n if (filesArray.length > maxFilesToShow) {\n newSuffixText.push(\n `... and ${filesArray.length - maxFilesToShow} more files`\n );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M,KAAK,OAAO,QAAQ,CAAC,KAAK,YAAY;IAC7C;IACA,QAAQ;IACT,EAAE,CACJ;AAIH,kBAAe,MAAM,GAAG,MAAM,EAAE,OAAO,cAAc,EAAE,OAAO,CAAC;GAG/D,MAAM,eAAe,eAClB,KAAK,WAAW;AACf,QAAI,OAAO,WAAW,YACpB,QAAO,MAAM,MAAM,OAAO,OAAO;aACxB,OAAO,WAAW,UAC3B,QAAO,MAAM,KAAK,OAAO,OAAO;aACvB,OAAO,WAAW,SAC3B,QAAO,MAAM,IAAI,OAAO,OAAO;aACtB,OAAO,WAAW,UAC3B,QAAO,MAAM,OAAO,OAAO,OAAO;KAEpC,CACD,KAAK,KAAK;GAGb,MAAM,iBACJ,aAAA,kCACI,IAAI,uBAAuB,KAAK,cAAc,CAAC,KAC/C;AACN,iBAAc,KAAK,GAAG,MAAM,KAAK,eAAe,CAAC,IAAI,aAAa,GAAG;;AAIvE,MAAI,WAAW,SAAS,eACtB,eAAc,KACZ,WAAW,WAAW,SAAS,eAAe,aAC/C;AAGH,SAAO,cAAc,KAAK,KAAK"}
|
|
1
|
+
{"version":3,"file":"PollJobsStep.js","names":[],"sources":["../../../src/workflows/steps/PollJobsStep.ts"],"sourcesContent":["import chalk from 'chalk';\nimport type { JobResult } from 'generaltranslation/api';\nimport { logger } from '../../console/logger.js';\nimport type { ApiClient } from '../../utils/api.js';\nimport { EnqueueFilesResult } from 'generaltranslation/types';\nimport type { JobResult as NormalizedJobResult } from 'generaltranslation/types';\nimport { TEMPLATE_FILE_NAME } from '../../utils/constants.js';\nimport type { FileProperties } from '../../types/files.js';\nimport {\n getFileTranslationKey,\n queryCompletedTranslationKeys,\n} from '../utils/queryCompletedTranslations.js';\nimport {\n getInlineElementsLabel,\n type InlineLibrary,\n} from '../../types/libraries.js';\n\nexport type PollJobsInput = {\n fileTracker: FileStatusTracker;\n fileQueryData: FileProperties[];\n jobData: EnqueueFilesResult;\n timeoutDuration: number;\n forceRetranslation?: boolean;\n};\n\nexport type FileStatusTracker = {\n completed: Map<string, FileProperties>;\n inProgress: Map<string, FileProperties>;\n failed: Map<string, FileProperties & { failureReason?: string }>;\n skipped: Map<string, FileProperties>;\n};\n\nexport type PollJobsOutput = {\n success: boolean;\n fileTracker: FileStatusTracker;\n};\n\nexport class PollTranslationJobsStep {\n private spinner: ReturnType<typeof logger.createProgressBar> | null = null;\n private previousProgress = 0;\n\n constructor(\n private api: ApiClient,\n private inlineLibrary?: InlineLibrary\n ) {}\n\n async run({\n fileTracker,\n fileQueryData,\n jobData,\n timeoutDuration,\n forceRetranslation,\n }: PollJobsInput): Promise<PollJobsOutput> {\n const startTime = Date.now();\n this.spinner = logger.createProgressBar(fileQueryData.length);\n const spinnerMessage = forceRetranslation\n ? 'Waiting for retranslation...'\n : 'Waiting for translation...';\n this.spinner.start(spinnerMessage);\n\n // Build a map of branchId:fileId:versionId:locale -> FileProperties\n const filePropertiesMap = new Map<string, FileProperties>();\n fileQueryData.forEach((item) => {\n filePropertiesMap.set(getFileTranslationKey(item), item);\n });\n\n // Initial query to check which files already have translations\n // Skip when force retranslation is enabled, since the server\n // no longer marks force-retranslated files as incomplete\n if (!forceRetranslation) {\n const completedKeys = await queryCompletedTranslationKeys(\n this.api,\n fileQueryData\n );\n\n completedKeys.forEach((fileKey) => {\n const fileProperties = filePropertiesMap.get(fileKey);\n if (fileProperties) {\n fileTracker.completed.set(fileKey, fileProperties);\n }\n });\n }\n\n // Build a map of jobs for quick lookup:\n // branchId:fileId:versionId:locale -> job\n const jobMap = new Map<\n string,\n (typeof jobData.jobData)[number] & { jobId: string }\n >();\n Object.entries(jobData.jobData).forEach(([jobId, job]) => {\n const jobLocale = this.api.resolveAliasLocale(job.targetLocale);\n const key = `${job.branchId}:${job.fileId}:${job.versionId}:${jobLocale}`;\n jobMap.set(key, { ...job, jobId, targetLocale: jobLocale });\n });\n\n // Build a map of jobs for quick lookup:\n // jobId -> file data for the job\n const jobFileMap = new Map<\n string,\n {\n branchId: string;\n fileId: string;\n versionId: string;\n locale: string;\n }\n >();\n Object.entries(jobData.jobData).forEach(([jobId, job]) => {\n const jobLocale = this.api.resolveAliasLocale(job.targetLocale);\n jobFileMap.set(jobId, {\n branchId: job.branchId,\n fileId: job.fileId,\n versionId: job.versionId,\n locale: jobLocale,\n });\n });\n\n // Categorize each file query item\n for (const item of fileQueryData) {\n const fileKey = getFileTranslationKey(item);\n\n // Check if translation already exists (completedAt is truthy)\n const existingTranslation = fileTracker.completed.get(fileKey);\n\n if (existingTranslation) {\n continue;\n }\n\n // Check if there's a job for this file\n const jobKey = `${item.branchId}:${item.fileId}:${item.versionId}:${item.locale}`;\n const job = jobMap.get(jobKey);\n\n if (job) {\n // Job exists - mark as in progress initially\n fileTracker.inProgress.set(fileKey, item);\n } else {\n // No job and no existing translation - mark as skipped\n fileTracker.skipped.set(fileKey, item);\n }\n }\n\n // Update spinner with initial status\n this.updateSpinner(fileTracker, fileQueryData);\n\n // If force retranslation, don't skip the initial check\n if (!forceRetranslation) {\n // Check if all jobs are already complete\n if (fileTracker.inProgress.size === 0) {\n this.spinner.stop(chalk.green('All translations ready'));\n return { success: true, fileTracker };\n }\n }\n\n const timeoutSeconds = Math.max(\n 0,\n timeoutDuration - (Date.now() - startTime) / 1000\n );\n\n const updateJobStatuses = (\n statuses: readonly (JobResult | NormalizedJobResult)[]\n ) => {\n for (const job of statuses) {\n const jobFileProperties = jobFileMap.get(job.jobId);\n if (!jobFileProperties) continue;\n\n const fileKey = `${jobFileProperties.branchId}:${jobFileProperties.fileId}:${jobFileProperties.versionId}:${jobFileProperties.locale}`;\n const fileProperties = filePropertiesMap.get(fileKey);\n if (!fileProperties) continue;\n\n if (job.status === 'completed') {\n fileTracker.completed.set(fileKey, fileProperties);\n } else if (job.status === 'failed') {\n fileTracker.failed.set(fileKey, {\n ...fileProperties,\n failureReason: job.error?.message ?? undefined,\n });\n } else if (job.status === 'unknown') {\n fileTracker.skipped.set(fileKey, fileProperties);\n } else {\n continue;\n }\n fileTracker.inProgress.delete(fileKey);\n jobFileMap.delete(job.jobId);\n }\n this.updateSpinner(fileTracker, fileQueryData);\n };\n\n try {\n const result = await this.api.awaitJobs([...jobFileMap.keys()], {\n pollingIntervalSeconds: 5,\n timeoutSeconds,\n onPoll: updateJobStatuses,\n });\n if (result.complete) updateJobStatuses(result.jobs);\n } catch (error) {\n this.spinner.stop(chalk.red('Error checking translation job status'));\n throw error;\n }\n\n if (fileTracker.inProgress.size === 0) {\n this.spinner.stop(chalk.green('Translation jobs finished'));\n return { success: true, fileTracker };\n }\n\n this.spinner.stop(chalk.red('Timed out waiting for translation jobs'));\n return { success: false, fileTracker };\n }\n\n private updateSpinner(\n fileTracker: FileStatusTracker,\n fileQueryData: FileProperties[]\n ): void {\n if (!this.spinner) return;\n\n const statusText = this.generateStatusSuffixText(\n fileTracker,\n fileQueryData\n );\n const currentProgress =\n fileTracker.completed.size +\n fileTracker.failed.size +\n fileTracker.skipped.size;\n const progressDelta = currentProgress - this.previousProgress;\n this.spinner.advance(progressDelta, statusText);\n this.previousProgress = currentProgress;\n }\n\n private generateStatusSuffixText(\n fileTracker: FileStatusTracker,\n fileQueryData: FileProperties[]\n ): string {\n // Simple progress indicator\n const progressText = `${chalk.green(\n `[${\n fileTracker.completed.size +\n fileTracker.failed.size +\n fileTracker.skipped.size\n }/${fileQueryData.length}]`\n )} translations completed`;\n\n // Get terminal height to adapt our output\n const terminalHeight = process.stdout.rows || 24;\n\n // If terminal is very small, just show the basic progress\n if (terminalHeight < 6) {\n return progressText;\n }\n\n const newSuffixText = [progressText];\n\n // Organize data by filename : locale\n const fileStatus = new Map<\n string,\n {\n completed: Set<string>;\n pending: Set<string>;\n failed: Set<string>;\n skipped: Set<string>;\n }\n >();\n\n // Initialize with all files and locales from fileQueryData\n for (const item of fileQueryData) {\n if (!fileStatus.has(item.fileName)) {\n fileStatus.set(item.fileName, {\n completed: new Set(),\n pending: new Set([item.locale]),\n failed: new Set(),\n skipped: new Set(),\n });\n } else {\n fileStatus.get(item.fileName)?.pending.add(item.locale);\n }\n }\n\n // Mark which ones are completed, failed, or skipped\n for (const [_, fileProperties] of fileTracker.completed) {\n const { fileName, locale } = fileProperties;\n const status = fileStatus.get(fileName);\n if (status) {\n status.pending.delete(locale);\n status.completed.add(locale);\n }\n }\n\n for (const [_, fileProperties] of fileTracker.failed) {\n const { fileName, locale } = fileProperties;\n const status = fileStatus.get(fileName);\n if (status) {\n status.pending.delete(locale);\n status.failed.add(locale);\n }\n }\n\n for (const [_, fileProperties] of fileTracker.skipped) {\n const { fileName, locale } = fileProperties;\n const status = fileStatus.get(fileName);\n if (status) {\n status.pending.delete(locale);\n status.skipped.add(locale);\n }\n }\n\n // Calculate how many files we can show based on terminal height\n const filesArray = Array.from(fileStatus.entries());\n const maxFilesToShow = Math.min(\n filesArray.length,\n terminalHeight - 3 // Header + progress + buffer\n );\n\n // Display each file with its status on a single line\n for (let i = 0; i < maxFilesToShow; i++) {\n const [fileName, status] = filesArray[i];\n\n // Create condensed locale status\n const localeStatuses: { locale: string; status: string }[] = [];\n\n // Add completed locales (green)\n if (status.completed.size > 0) {\n localeStatuses.push(\n ...Array.from(status.completed).map((locale) => ({\n locale,\n status: 'completed',\n }))\n );\n }\n\n // Add skipped locales (green)\n if (status.skipped.size > 0) {\n localeStatuses.push(\n ...Array.from(status.skipped).map((locale) => ({\n locale,\n status: 'skipped',\n }))\n );\n }\n\n // Add failed locales (red)\n if (status.failed.size > 0) {\n localeStatuses.push(\n ...Array.from(status.failed).map((locale) => ({\n locale,\n status: 'failed',\n }))\n );\n }\n\n // Add pending locales (yellow)\n if (status.pending.size > 0) {\n localeStatuses.push(\n ...Array.from(status.pending).map((locale) => ({\n locale,\n status: 'pending',\n }))\n );\n }\n\n // Sort localeStatuses by locale\n localeStatuses.sort((a, b) => a.locale.localeCompare(b.locale));\n\n // Add colors\n const localeString = localeStatuses\n .map((locale) => {\n if (locale.status === 'completed') {\n return chalk.green(locale.locale);\n } else if (locale.status === 'skipped') {\n return chalk.gray(locale.locale);\n } else if (locale.status === 'failed') {\n return chalk.red(locale.locale);\n } else if (locale.status === 'pending') {\n return chalk.yellow(locale.locale);\n }\n })\n .join(', ');\n\n // Format the line\n const prettyFileName =\n fileName === TEMPLATE_FILE_NAME\n ? `<${getInlineElementsLabel(this.inlineLibrary)}>`\n : fileName;\n newSuffixText.push(`${chalk.bold(prettyFileName)} [${localeString}]`);\n }\n\n // If we couldn't show all files, add an indicator\n if (filesArray.length > maxFilesToShow) {\n newSuffixText.push(\n `... and ${filesArray.length - maxFilesToShow} more files`\n );\n }\n\n return newSuffixText.join('\\n');\n }\n}\n"],"mappings":";;;;;;AAqCA,IAAa,0BAAb,MAAqC;CACnC,UAAsE;CACtE,mBAA2B;CAE3B,YACE,KACA,eACA;AAFQ,OAAA,MAAA;AACA,OAAA,gBAAA;;CAGV,MAAM,IAAI,EACR,aACA,eACA,SACA,iBACA,sBACyC;EACzC,MAAM,YAAY,KAAK,KAAK;AAC5B,OAAK,UAAU,OAAO,kBAAkB,cAAc,OAAO;EAC7D,MAAM,iBAAiB,qBACnB,iCACA;AACJ,OAAK,QAAQ,MAAM,eAAe;EAGlC,MAAM,oCAAoB,IAAI,KAA6B;AAC3D,gBAAc,SAAS,SAAS;AAC9B,qBAAkB,IAAI,sBAAsB,KAAK,EAAE,KAAK;IACxD;AAKF,MAAI,CAAC,mBAMH,EAAA,MAL4B,8BAC1B,KAAK,KACL,cACD,EAEa,SAAS,YAAY;GACjC,MAAM,iBAAiB,kBAAkB,IAAI,QAAQ;AACrD,OAAI,eACF,aAAY,UAAU,IAAI,SAAS,eAAe;IAEpD;EAKJ,MAAM,yBAAS,IAAI,KAGhB;AACH,SAAO,QAAQ,QAAQ,QAAQ,CAAC,SAAS,CAAC,OAAO,SAAS;GACxD,MAAM,YAAY,KAAK,IAAI,mBAAmB,IAAI,aAAa;GAC/D,MAAM,MAAM,GAAG,IAAI,SAAS,GAAG,IAAI,OAAO,GAAG,IAAI,UAAU,GAAG;AAC9D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
5
5
|
"bin": "bin/main.js",
|
|
6
6
|
"files": [
|
|
@@ -118,10 +118,10 @@
|
|
|
118
118
|
"yaml": "^2.8.0",
|
|
119
119
|
"@generaltranslation/format": "0.1.9",
|
|
120
120
|
"@generaltranslation/icu": "0.1.2",
|
|
121
|
-
"@generaltranslation/python-extractor": "0.2.
|
|
122
|
-
"@generaltranslation/supported-locales": "2.1.
|
|
123
|
-
"@generaltranslation/vue-extractor": "0.1.
|
|
124
|
-
"generaltranslation": "9.5.
|
|
121
|
+
"@generaltranslation/python-extractor": "0.2.66",
|
|
122
|
+
"@generaltranslation/supported-locales": "2.1.47",
|
|
123
|
+
"@generaltranslation/vue-extractor": "0.1.25",
|
|
124
|
+
"generaltranslation": "9.5.11",
|
|
125
125
|
"gt-remark": "1.0.12"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|