gt 2.19.0 → 2.20.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 +30 -0
- package/dist/api/collectUserEditDiffs.js +23 -23
- package/dist/api/collectUserEditDiffs.js.map +1 -1
- package/dist/api/downloadFileBatch.js +7 -4
- package/dist/api/downloadFileBatch.js.map +1 -1
- package/dist/api/saveLocalEdits.js +2 -2
- package/dist/api/saveLocalEdits.js.map +1 -1
- package/dist/cli/base.d.ts +2 -0
- package/dist/cli/base.js +45 -2
- package/dist/cli/base.js.map +1 -1
- package/dist/cli/commands/api.d.ts +17 -0
- package/dist/cli/commands/api.js +153 -0
- package/dist/cli/commands/api.js.map +1 -0
- package/dist/cli/commands/upload.js +15 -5
- package/dist/cli/commands/upload.js.map +1 -1
- package/dist/cli/commands/utils/validation.d.ts +4 -0
- package/dist/cli/commands/utils/validation.js +12 -5
- package/dist/cli/commands/utils/validation.js.map +1 -1
- package/dist/config/generateSettings.js +7 -0
- package/dist/config/generateSettings.js.map +1 -1
- package/dist/console/index.d.ts +1 -0
- package/dist/console/index.js +2 -1
- package/dist/console/index.js.map +1 -1
- package/dist/formats/files/aggregateFiles.js +14 -6
- package/dist/formats/files/aggregateFiles.js.map +1 -1
- package/dist/fs/fileContent.d.ts +65 -0
- package/dist/fs/fileContent.js +171 -0
- package/dist/fs/fileContent.js.map +1 -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/state/recentDownloads.d.ts +3 -2
- package/dist/state/recentDownloads.js.map +1 -1
- package/dist/translation/reviewSetupWarning.js +3 -3
- package/dist/translation/reviewSetupWarning.js.map +1 -1
- package/dist/utils/api.d.ts +194 -0
- package/dist/utils/api.js +268 -0
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/persistPostprocessHashes.d.ts +1 -7
- package/dist/utils/persistPostprocessHashes.js +15 -1
- package/dist/utils/persistPostprocessHashes.js.map +1 -1
- package/dist/workflows/download.js +4 -4
- package/dist/workflows/download.js.map +1 -1
- package/dist/workflows/enqueue.js +4 -4
- package/dist/workflows/enqueue.js.map +1 -1
- package/dist/workflows/publish.js +2 -2
- package/dist/workflows/publish.js.map +1 -1
- package/dist/workflows/setupProject.js +4 -4
- package/dist/workflows/setupProject.js.map +1 -1
- package/dist/workflows/stage.js +7 -7
- package/dist/workflows/stage.js.map +1 -1
- package/dist/workflows/steps/BranchStep.d.ts +2 -2
- package/dist/workflows/steps/BranchStep.js +9 -9
- package/dist/workflows/steps/BranchStep.js.map +1 -1
- package/dist/workflows/steps/DownloadStep.d.ts +3 -3
- package/dist/workflows/steps/DownloadStep.js +3 -3
- package/dist/workflows/steps/DownloadStep.js.map +1 -1
- package/dist/workflows/steps/EnqueueStep.d.ts +5 -3
- package/dist/workflows/steps/EnqueueStep.js.map +1 -1
- package/dist/workflows/steps/PollJobsStep.d.ts +3 -3
- package/dist/workflows/steps/PollJobsStep.js +6 -6
- package/dist/workflows/steps/PollJobsStep.js.map +1 -1
- package/dist/workflows/steps/PublishStep.d.ts +3 -3
- package/dist/workflows/steps/PublishStep.js +3 -3
- package/dist/workflows/steps/PublishStep.js.map +1 -1
- package/dist/workflows/steps/SetupStep.d.ts +6 -4
- package/dist/workflows/steps/SetupStep.js.map +1 -1
- package/dist/workflows/steps/TagStep.d.ts +3 -3
- package/dist/workflows/steps/TagStep.js +3 -3
- package/dist/workflows/steps/TagStep.js.map +1 -1
- package/dist/workflows/steps/UploadSourcesStep.d.ts +3 -3
- package/dist/workflows/steps/UploadSourcesStep.js +8 -6
- package/dist/workflows/steps/UploadSourcesStep.js.map +1 -1
- package/dist/workflows/steps/UploadTranslationsStep.d.ts +3 -3
- package/dist/workflows/steps/UploadTranslationsStep.js +24 -6
- package/dist/workflows/steps/UploadTranslationsStep.js.map +1 -1
- package/dist/workflows/upload.js +4 -4
- package/dist/workflows/upload.js.map +1 -1
- package/dist/workflows/utils/filterFilesForEnqueue.d.ts +2 -2
- package/dist/workflows/utils/filterFilesForEnqueue.js.map +1 -1
- package/dist/workflows/utils/queryCompletedTranslations.d.ts +3 -3
- package/dist/workflows/utils/queryCompletedTranslations.js +2 -2
- package/dist/workflows/utils/queryCompletedTranslations.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadSourcesStep.js","names":[],"sources":["../../../src/workflows/steps/UploadSourcesStep.ts"],"sourcesContent":["import type { FileToUpload } from 'generaltranslation/types';\nimport { logger } from '../../console/logger.js';\nimport { recordWarning } from '../../state/translateWarnings.js';\nimport type {
|
|
1
|
+
{"version":3,"file":"UploadSourcesStep.js","names":[],"sources":["../../../src/workflows/steps/UploadSourcesStep.ts"],"sourcesContent":["import type { GetFileInfoResponse } from 'generaltranslation/api';\nimport type { FileToUpload } from 'generaltranslation/types';\nimport { logger } from '../../console/logger.js';\nimport { recordWarning } from '../../state/translateWarnings.js';\nimport type { ApiClient } from '../../utils/api.js';\nimport type { Settings } from '../../types/index.js';\nimport chalk from 'chalk';\nimport { BranchData } from '../../types/branch.js';\nimport type { FileReference, OrphanedFile } from 'generaltranslation/types';\n\ntype MoveMapping = {\n oldFileId: string;\n newFileId: string;\n newFileName: string;\n};\n\ntype UploadSourcesClient = Pick<\n ApiClient,\n | 'queryFileData'\n | 'getOrphanedFiles'\n | 'processFileMoves'\n | 'uploadSourceFiles'\n>;\ntype UploadSourcesSettings = Pick<Settings, 'defaultLocale'>;\n\nexport class UploadSourcesStep {\n private spinner = logger.createSpinner('dots');\n\n constructor(\n private gt: UploadSourcesClient,\n private settings: UploadSourcesSettings\n ) {}\n\n /**\n * Detects file moves by comparing local files against orphaned files.\n * A move is detected when a local file has the same versionId (content hash)\n * as an orphaned file but a different fileId (path hash).\n */\n private detectMoves(\n localFiles: FileToUpload[],\n orphanedFiles: OrphanedFile[]\n ): MoveMapping[] {\n const moves: MoveMapping[] = [];\n\n // Build a map of versionId -> orphaned file\n const orphansByVersionId = new Map<string, OrphanedFile>();\n for (const orphan of orphanedFiles) {\n orphansByVersionId.set(orphan.versionId, orphan);\n }\n\n // Check each local file against orphaned files\n for (const local of localFiles) {\n const orphan = orphansByVersionId.get(local.versionId);\n if (orphan && orphan.fileId !== local.fileId) {\n // Same content, different path = move detected\n moves.push({\n oldFileId: orphan.fileId,\n newFileId: local.fileId,\n newFileName: local.fileName,\n });\n // Remove from map to avoid matching same orphan twice\n orphansByVersionId.delete(local.versionId);\n }\n }\n\n return moves;\n }\n\n async run({\n files,\n branchData,\n }: {\n files: FileToUpload[];\n branchData: BranchData;\n }): Promise<FileReference[]> {\n if (files.length === 0) {\n logger.info('No files to upload found... skipping upload step');\n return [];\n }\n\n const currentBranchId = branchData.currentBranch.id;\n\n this.spinner.start(\n `Syncing ${files.length} file${files.length !== 1 ? 's' : ''} with General Translation API...`\n );\n\n // Query file data and orphaned files in parallel\n const [fileData, orphanedFilesResult] = await Promise.all([\n this.gt.queryFileData({\n sourceFiles: files.map((f) => ({\n fileId: f.fileId,\n versionId: f.versionId,\n branchId: f.branchId ?? currentBranchId,\n })),\n }),\n this.gt.getOrphanedFiles(\n currentBranchId,\n files.map((f) => f.fileId)\n ),\n ]);\n\n // Detect file moves\n const moves = this.detectMoves(files, orphanedFilesResult.orphanedFiles);\n\n // Track successfully moved files\n let successfullyMovedFileIds = new Set<string>();\n\n // Process moves if any were detected\n if (moves.length > 0) {\n this.spinner.message(\n `Detected ${moves.length} moved file${moves.length !== 1 ? 's' : ''}, preserving translations...`\n );\n\n const moveResult = await this.gt.processFileMoves(moves, {\n branchId: currentBranchId,\n });\n\n // Only track files where the move actually succeeded\n successfullyMovedFileIds = new Set(\n moveResult.results.filter((r) => r.success).map((r) => r.newFileId)\n );\n\n const failed = moveResult.summary.failed;\n\n if (failed > 0) {\n logger.warn(\n `Failed to migrate ${failed} moved file${failed !== 1 ? 's' : ''}`\n );\n for (const r of moveResult.results) {\n if (!r.success) {\n const move = moves.find((m) => m.newFileId === r.newFileId);\n recordWarning(\n 'failed_move',\n move?.newFileName ?? r.newFileId,\n r.error ?? 'Unknown error'\n );\n }\n }\n }\n }\n\n // Build a map of branch:fileId:versionId to fileData\n const fileDataMap = new Map<\n string,\n GetFileInfoResponse['sourceFiles'][number]\n >();\n fileData.sourceFiles?.forEach((f) => {\n fileDataMap.set(`${f.branchId}:${f.fileId}:${f.versionId}`, f);\n });\n\n // Build a list of files that need to be uploaded\n const filesToUpload: FileToUpload[] = [];\n const filesToSkipUpload: FileToUpload[] = [];\n files.forEach((f) => {\n const key = `${f.branchId ?? currentBranchId}:${f.fileId}:${f.versionId}`;\n if (fileDataMap.has(key) || successfullyMovedFileIds.has(f.fileId)) {\n filesToSkipUpload.push(f);\n } else {\n filesToUpload.push(f);\n }\n });\n\n const response = await this.gt.uploadSourceFiles(\n filesToUpload.map((f) => ({\n source: {\n ...f,\n branchId: f.branchId ?? currentBranchId,\n locale: this.settings.defaultLocale,\n incomingBranchId: branchData.incomingBranch?.id,\n checkedOutBranchId: branchData.checkedOutBranch?.id,\n },\n })),\n { sourceLocale: this.settings.defaultLocale }\n );\n\n // The API may not echo transformFormat, so preserve it from local inputs.\n const localFileMap = new Map(\n files.map((f) => [`${f.fileId}:${f.versionId}`, f])\n );\n\n const result: FileReference[] = response.uploadedFiles.map(\n (uploadedFile) => {\n const localFile = localFileMap.get(\n `${uploadedFile.fileId}:${uploadedFile.versionId}`\n );\n return {\n branchId:\n uploadedFile.branchId ?? localFile?.branchId ?? currentBranchId,\n fileId: uploadedFile.fileId,\n versionId: uploadedFile.versionId,\n fileName: uploadedFile.fileName,\n fileFormat: uploadedFile.fileFormat,\n dataFormat: localFile?.dataFormat,\n transformFormat: localFile?.transformFormat,\n };\n }\n );\n\n // Merge files that were already uploaded into the result\n result.push(\n ...filesToSkipUpload.map((f) => ({\n fileId: f.fileId,\n versionId: f.versionId,\n branchId: f.branchId ?? currentBranchId,\n fileName: f.fileName,\n fileFormat: f.fileFormat,\n transformFormat: f.transformFormat,\n dataFormat: f.dataFormat,\n locale: f.locale,\n }))\n );\n\n const moveMsg = moves.length > 0 ? ` (${moves.length} moved)` : '';\n this.spinner.stop(chalk.green(`Files uploaded successfully${moveMsg}`));\n\n return result;\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ApiClient } from '../../utils/api.js';
|
|
2
2
|
import { Settings } from '../../types/index.js';
|
|
3
3
|
import { type EntryMap } from '../../fs/config/downloadedVersions.js';
|
|
4
4
|
import type { FileReference, FileToUpload } from 'generaltranslation/types';
|
|
@@ -19,10 +19,10 @@ export declare function partitionTranslationsByLockfile(files: UploadTranslation
|
|
|
19
19
|
skippedCount: number;
|
|
20
20
|
};
|
|
21
21
|
export declare class UploadTranslationsStep {
|
|
22
|
-
private
|
|
22
|
+
private api;
|
|
23
23
|
private settings;
|
|
24
24
|
private spinner;
|
|
25
|
-
constructor(
|
|
25
|
+
constructor(api: Pick<ApiClient, 'uploadTranslations'>, settings: Settings);
|
|
26
26
|
run({ files }: UploadTranslationsInput): Promise<FileReference[]>;
|
|
27
27
|
/**
|
|
28
28
|
* Records the content hash of each server-confirmed upload in gt-lock.json
|
|
@@ -31,8 +31,8 @@ function partitionTranslationsByLockfile(files, entryMap) {
|
|
|
31
31
|
}
|
|
32
32
|
var UploadTranslationsStep = class {
|
|
33
33
|
spinner = logger.createSpinner("dots");
|
|
34
|
-
constructor(
|
|
35
|
-
this.
|
|
34
|
+
constructor(api, settings) {
|
|
35
|
+
this.api = api;
|
|
36
36
|
this.settings = settings;
|
|
37
37
|
}
|
|
38
38
|
async run({ files }) {
|
|
@@ -49,10 +49,28 @@ var UploadTranslationsStep = class {
|
|
|
49
49
|
}
|
|
50
50
|
const totalTranslations = filesToUpload.reduce((acc, f) => acc + f.translations.length, 0);
|
|
51
51
|
this.spinner.start(`Uploading ${totalTranslations} translation file${totalTranslations !== 1 ? "s" : ""} to the General Translation API...`);
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const response = await this.api.uploadTranslations(filesToUpload, { sourceLocale: this.settings.defaultLocale });
|
|
53
|
+
const localFiles = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const { source, translations } of filesToUpload) for (const translation of translations) localFiles.set(`${translation.fileId}:${translation.versionId}`, {
|
|
55
|
+
source,
|
|
56
|
+
translation
|
|
57
|
+
});
|
|
58
|
+
const result = response.uploadedFiles.map((uploadedFile) => {
|
|
59
|
+
const localFile = localFiles.get(`${uploadedFile.fileId}:${uploadedFile.versionId}`);
|
|
60
|
+
const branchId = uploadedFile.branchId ?? localFile?.translation.branchId ?? localFile?.source.branchId ?? lockfile.data.branchId;
|
|
61
|
+
const dataFormat = localFile?.translation.dataFormat;
|
|
62
|
+
const transformFormat = localFile?.translation.transformFormat;
|
|
63
|
+
return {
|
|
64
|
+
branchId,
|
|
65
|
+
fileId: uploadedFile.fileId,
|
|
66
|
+
versionId: uploadedFile.versionId,
|
|
67
|
+
fileName: uploadedFile.fileName,
|
|
68
|
+
fileFormat: uploadedFile.fileFormat,
|
|
69
|
+
...dataFormat && { dataFormat },
|
|
70
|
+
...transformFormat && { transformFormat },
|
|
71
|
+
locale: uploadedFile.locale
|
|
72
|
+
};
|
|
73
|
+
});
|
|
56
74
|
const uploadedCount = result.length;
|
|
57
75
|
this.spinner.stop(chalk.green(`Uploaded ${uploadedCount} translation file${uploadedCount !== 1 ? "s" : ""}${skippedCount > 0 ? `, skipped ${skippedCount} unchanged` : ""}`));
|
|
58
76
|
if (uploadedCount < totalTranslations) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadTranslationsStep.js","names":[],"sources":["../../../src/workflows/steps/UploadTranslationsStep.ts"],"sourcesContent":["import { logger } from '../../console/logger.js';\nimport {
|
|
1
|
+
{"version":3,"file":"UploadTranslationsStep.js","names":[],"sources":["../../../src/workflows/steps/UploadTranslationsStep.ts"],"sourcesContent":["import { logger } from '../../console/logger.js';\nimport type { ApiClient } from '../../utils/api.js';\nimport { Settings } from '../../types/index.js';\nimport chalk from 'chalk';\nimport {\n readLockfile,\n writeLockfile,\n findOrCreateEntry,\n type EntryMap,\n} from '../../fs/config/downloadedVersions.js';\nimport { hashStringSync } from '../../utils/hash.js';\nimport type { FileReference, FileToUpload } from 'generaltranslation/types';\n\ntype UploadTranslationsInput = {\n files: {\n source: FileToUpload;\n translations: FileToUpload[];\n }[];\n};\n\ntype UploadedTranslation = Awaited<\n ReturnType<ApiClient['uploadTranslations']>\n>['uploadedFiles'][number];\ntype ConfirmedTranslationReference = FileReference &\n Pick<UploadedTranslation, 'locale'>;\n\n/**\n * Splits translations into ones that need uploading and ones that can be\n * skipped because their content still matches the gt-lock.json hash recorded\n * at the last sync (download/translate/upload). Files without a lock entry —\n * or with a stale versionId — are always uploaded.\n */\nexport function partitionTranslationsByLockfile(\n files: UploadTranslationsInput['files'],\n entryMap: EntryMap\n): {\n filesToUpload: UploadTranslationsInput['files'];\n skippedCount: number;\n} {\n let skippedCount = 0;\n const filesToUpload = files\n .map((file) => {\n const translations = file.translations.filter((translation) => {\n const entry = entryMap.get(translation.fileId);\n if (!entry || entry.versionId !== translation.versionId) return true;\n const lockHash =\n entry.translations[translation.locale]?.postProcessHash;\n if (!lockHash || lockHash !== hashStringSync(translation.content)) {\n return true;\n }\n skippedCount++;\n return false;\n });\n return { source: file.source, translations };\n })\n .filter((file) => file.translations.length > 0);\n\n return { filesToUpload, skippedCount };\n}\n\nexport class UploadTranslationsStep {\n private spinner = logger.createSpinner('dots');\n\n constructor(\n private api: Pick<ApiClient, 'uploadTranslations'>,\n private settings: Settings\n ) {}\n\n async run({ files }: UploadTranslationsInput): Promise<FileReference[]> {\n // Filter to only files that have translations\n const withTranslations = files.filter((f) => f.translations.length > 0);\n\n if (withTranslations.length === 0) {\n logger.info(\n 'No translation files to upload... skipping upload translations step'\n );\n return [];\n }\n\n // Local translation files are the source of truth: everything local is\n // uploaded (the endpoint is an upsert, so existing translations are\n // overwritten). The one optimization is the lockfile: files whose content\n // hash still matches gt-lock.json are unchanged since the last sync and\n // can be skipped. Without a lockfile, everything uploads.\n const lockfile = readLockfile(this.settings);\n const { filesToUpload, skippedCount } = partitionTranslationsByLockfile(\n withTranslations,\n lockfile.entryMap\n );\n\n if (filesToUpload.length === 0) {\n logger.info(\n chalk.green(\n `All ${skippedCount} translation file${skippedCount !== 1 ? 's are' : ' is'} unchanged since the last sync... skipping upload translations step`\n )\n );\n return [];\n }\n\n const totalTranslations = filesToUpload.reduce(\n (acc, f) => acc + f.translations.length,\n 0\n );\n\n this.spinner.start(\n `Uploading ${totalTranslations} translation file${totalTranslations !== 1 ? 's' : ''} to the General Translation API...`\n );\n\n const response = await this.api.uploadTranslations(filesToUpload, {\n sourceLocale: this.settings.defaultLocale,\n });\n\n const localFiles = new Map<\n string,\n { source: FileToUpload; translation: FileToUpload }\n >();\n for (const { source, translations } of filesToUpload) {\n for (const translation of translations) {\n localFiles.set(`${translation.fileId}:${translation.versionId}`, {\n source,\n translation,\n });\n }\n }\n const result: ConfirmedTranslationReference[] = response.uploadedFiles.map(\n (uploadedFile) => {\n const localFile = localFiles.get(\n `${uploadedFile.fileId}:${uploadedFile.versionId}`\n );\n const branchId =\n uploadedFile.branchId ??\n localFile?.translation.branchId ??\n localFile?.source.branchId ??\n lockfile.data.branchId;\n const dataFormat = localFile?.translation.dataFormat;\n const transformFormat = localFile?.translation.transformFormat;\n return {\n branchId,\n fileId: uploadedFile.fileId,\n versionId: uploadedFile.versionId,\n fileName: uploadedFile.fileName,\n fileFormat: uploadedFile.fileFormat,\n ...(dataFormat && { dataFormat }),\n ...(transformFormat && { transformFormat }),\n locale: uploadedFile.locale,\n };\n }\n );\n // Report the server-confirmed count, not the attempted count — the\n // endpoint drops files it failed to persist without erroring\n const uploadedCount = result.length;\n this.spinner.stop(\n chalk.green(\n `Uploaded ${uploadedCount} translation file${uploadedCount !== 1 ? 's' : ''}${skippedCount > 0 ? `, skipped ${skippedCount} unchanged` : ''}`\n )\n );\n if (uploadedCount < totalTranslations) {\n const missingCount = totalTranslations - uploadedCount;\n logger.warn(\n chalk.yellow(\n `${missingCount} translation file${missingCount !== 1 ? 's were' : ' was'} not persisted by the server`\n )\n );\n }\n\n this.recordUploadedHashes(lockfile, filesToUpload, result);\n\n return result;\n }\n\n /**\n * Records the content hash of each server-confirmed upload in gt-lock.json\n * so unchanged files are skipped on the next run.\n */\n private recordUploadedHashes(\n lockfile: ReturnType<typeof readLockfile>,\n uploaded: UploadTranslationsInput['files'],\n confirmed: ConfirmedTranslationReference[]\n ): void {\n const confirmedKeys = new Set(\n confirmed\n .filter((file) => file.locale)\n .map((file) => `${file.fileId}:${file.locale}`)\n );\n if (confirmedKeys.size === 0) return;\n\n const updatedAt = new Date().toISOString();\n for (const file of uploaded) {\n for (const translation of file.translations) {\n if (!confirmedKeys.has(`${translation.fileId}:${translation.locale}`)) {\n continue;\n }\n const entry = findOrCreateEntry(\n lockfile.entryMap,\n lockfile.data.entries,\n translation.fileId,\n translation.versionId\n );\n entry.translations[translation.locale] = {\n ...entry.translations[translation.locale],\n updatedAt,\n postProcessHash: hashStringSync(translation.content),\n };\n }\n }\n writeLockfile(lockfile.data, lockfile.originalV1);\n }\n}\n"],"mappings":"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"}
|
package/dist/workflows/upload.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from "../console/logger.js";
|
|
2
|
-
import { gt } from "../utils/gt.js";
|
|
3
2
|
import { logErrorAndExit } from "../console/logging.js";
|
|
4
3
|
import { branchResolutionError, withOriginalError } from "../console/index.js";
|
|
4
|
+
import { api } from "../utils/api.js";
|
|
5
5
|
import { syncFonts } from "./utils/syncFonts.js";
|
|
6
6
|
import { BranchStep } from "./steps/BranchStep.js";
|
|
7
7
|
import { UploadSourcesStep } from "./steps/UploadSourcesStep.js";
|
|
@@ -18,9 +18,9 @@ async function runUploadFilesWorkflow({ files, options }) {
|
|
|
18
18
|
try {
|
|
19
19
|
logger.message(chalk.cyan("Files to upload:") + "\n" + files.map((file) => ` - ${chalk.bold(file.source.fileName)}${file.translations.length > 0 ? ` -> ${file.translations.map((t) => t.locale).join(", ")}` : ""}`).join("\n"));
|
|
20
20
|
await syncFonts(options);
|
|
21
|
-
const branchStep = new BranchStep(
|
|
22
|
-
const uploadStep = new UploadSourcesStep(
|
|
23
|
-
const uploadTranslationsStep = new UploadTranslationsStep(
|
|
21
|
+
const branchStep = new BranchStep(api, options);
|
|
22
|
+
const uploadStep = new UploadSourcesStep(api, options);
|
|
23
|
+
const uploadTranslationsStep = new UploadTranslationsStep(api, options);
|
|
24
24
|
const branchData = await branchStep.run();
|
|
25
25
|
if (!branchData) return logErrorAndExit(branchResolutionError);
|
|
26
26
|
await uploadStep.run({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","names":[],"sources":["../../src/workflows/upload.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { branchResolutionError, withOriginalError } from '../console/index.js';\nimport { logger } from '../console/logger.js';\nimport { logErrorAndExit } from '../console/logging.js';\nimport { Settings } from '../types/index.js';\nimport {
|
|
1
|
+
{"version":3,"file":"upload.js","names":[],"sources":["../../src/workflows/upload.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { branchResolutionError, withOriginalError } from '../console/index.js';\nimport { logger } from '../console/logger.js';\nimport { logErrorAndExit } from '../console/logging.js';\nimport { Settings } from '../types/index.js';\nimport { api } from '../utils/api.js';\nimport { syncFonts } from './utils/syncFonts.js';\nimport { BranchStep } from './steps/BranchStep.js';\nimport { UploadSourcesStep } from './steps/UploadSourcesStep.js';\nimport { UploadTranslationsStep } from './steps/UploadTranslationsStep.js';\nimport type { FileToUpload } from 'generaltranslation/types';\nimport { BranchData } from '../types/branch.js';\n\n/**\n * Uploads multiple files to the API using a workflow pattern\n * @param files - Array of file objects to upload\n * @param options - The options for the API call\n * @returns The branch data resolved during the workflow\n */\nexport async function runUploadFilesWorkflow({\n files,\n options,\n}: {\n files: {\n source: FileToUpload;\n translations: FileToUpload[];\n }[];\n options: Settings;\n}): Promise<{ branchData: BranchData }> {\n try {\n logger.message(\n chalk.cyan('Files to upload:') +\n '\\n' +\n files\n .map(\n (file) =>\n ` - ${chalk.bold(file.source.fileName)}${file.translations.length > 0 ? ` -> ${file.translations.map((t) => t.locale).join(', ')}` : ''}`\n )\n .join('\\n')\n );\n\n // Sync fonts first (locale-invariant) so they're available when\n // translating formats that need them.\n await syncFonts(options);\n\n // Create workflow steps\n const branchStep = new BranchStep(api, options);\n const uploadStep = new UploadSourcesStep(api, options);\n const uploadTranslationsStep = new UploadTranslationsStep(api, options);\n\n // Step 1: Resolve branch information\n const branchData = await branchStep.run();\n\n if (!branchData) {\n return logErrorAndExit(branchResolutionError);\n }\n\n await uploadStep.run({ files: files.map((f) => f.source), branchData });\n\n // Step 3: Upload translations (if any exist)\n const filesWithTranslations = files.filter(\n (f) => f.translations.length > 0\n );\n if (filesWithTranslations.length > 0) {\n await uploadTranslationsStep.run({\n files: filesWithTranslations,\n });\n }\n\n logger.success('All files uploaded successfully');\n return { branchData };\n } catch (error) {\n return logErrorAndExit(\n withOriginalError(\n 'Files could not be uploaded. Check the files, branch configuration, and API credentials, then try again.',\n error\n )\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,eAAsB,uBAAuB,EAC3C,OACA,WAOsC;AACtC,KAAI;AACF,SAAO,QACL,MAAM,KAAK,mBAAmB,GAC5B,OACA,MACG,KACE,SACC,OAAO,MAAM,KAAK,KAAK,OAAO,SAAS,GAAG,KAAK,aAAa,SAAS,IAAI,OAAO,KAAK,aAAa,KAAK,MAAM,EAAE,OAAO,CAAC,KAAK,KAAK,KAAK,KACzI,CACA,KAAK,KAAK,CAChB;AAID,QAAM,UAAU,QAAQ;EAGxB,MAAM,aAAa,IAAI,WAAW,KAAK,QAAQ;EAC/C,MAAM,aAAa,IAAI,kBAAkB,KAAK,QAAQ;EACtD,MAAM,yBAAyB,IAAI,uBAAuB,KAAK,QAAQ;EAGvE,MAAM,aAAa,MAAM,WAAW,KAAK;AAEzC,MAAI,CAAC,WACH,QAAO,gBAAgB,sBAAsB;AAG/C,QAAM,WAAW,IAAI;GAAE,OAAO,MAAM,KAAK,MAAM,EAAE,OAAO;GAAE;GAAY,CAAC;EAGvE,MAAM,wBAAwB,MAAM,QACjC,MAAM,EAAE,aAAa,SAAS,EAChC;AACD,MAAI,sBAAsB,SAAS,EACjC,OAAM,uBAAuB,IAAI,EAC/B,OAAO,uBACR,CAAC;AAGJ,SAAO,QAAQ,kCAAkC;AACjD,SAAO,EAAE,YAAY;UACd,OAAO;AACd,SAAO,gBACL,kBACE,4GACA,MACD,CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ApiClient } from '../../utils/api.js';
|
|
2
2
|
import type { FileReference } from 'generaltranslation/types';
|
|
3
|
-
type FilterFilesForEnqueueClient = Pick<
|
|
3
|
+
type FilterFilesForEnqueueClient = Pick<ApiClient, 'queryFileData'>;
|
|
4
4
|
export type EnqueueFilterResult = {
|
|
5
5
|
filesToEnqueue: FileReference[];
|
|
6
6
|
skippedFiles: FileReference[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterFilesForEnqueue.js","names":[],"sources":["../../../src/workflows/utils/filterFilesForEnqueue.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"filterFilesForEnqueue.js","names":[],"sources":["../../../src/workflows/utils/filterFilesForEnqueue.ts"],"sourcesContent":["import type { ApiClient } from '../../utils/api.js';\nimport type { FileReference } from 'generaltranslation/types';\nimport type { FileProperties } from '../../types/files.js';\nimport {\n getFileTranslationKey,\n queryCompletedTranslationKeys,\n} from './queryCompletedTranslations.js';\n\ntype FilterFilesForEnqueueClient = Pick<ApiClient, 'queryFileData'>;\n\nexport type EnqueueFilterResult = {\n filesToEnqueue: FileReference[];\n skippedFiles: FileReference[];\n};\n\nexport async function filterFilesForEnqueue({\n gt,\n files,\n locales,\n force,\n}: {\n gt: FilterFilesForEnqueueClient;\n files: FileReference[];\n locales: string[];\n force?: boolean;\n}): Promise<EnqueueFilterResult> {\n if (force || files.length === 0 || locales.length === 0) {\n return { filesToEnqueue: files, skippedFiles: [] };\n }\n\n const fileQueryData: FileProperties[] = files.flatMap((file) =>\n locales.map((locale) => ({\n branchId: file.branchId,\n fileId: file.fileId,\n versionId: file.versionId,\n fileName: file.fileName,\n locale,\n }))\n );\n\n let completedKeys: Set<string>;\n try {\n completedKeys = await queryCompletedTranslationKeys(gt, fileQueryData);\n } catch {\n return { filesToEnqueue: files, skippedFiles: [] };\n }\n\n const filesToEnqueue: FileReference[] = [];\n const skippedFiles: FileReference[] = [];\n\n for (const file of files) {\n const hasEveryLocale = locales.every((locale) =>\n completedKeys.has(\n getFileTranslationKey({\n branchId: file.branchId,\n fileId: file.fileId,\n versionId: file.versionId,\n locale,\n })\n )\n );\n\n if (hasEveryLocale) {\n skippedFiles.push(file);\n } else {\n filesToEnqueue.push(file);\n }\n }\n\n return { filesToEnqueue, skippedFiles };\n}\n"],"mappings":";;AAeA,eAAsB,sBAAsB,EAC1C,IACA,OACA,SACA,SAM+B;AAC/B,KAAI,SAAS,MAAM,WAAW,KAAK,QAAQ,WAAW,EACpD,QAAO;EAAE,gBAAgB;EAAO,cAAc,EAAE;EAAE;CAGpD,MAAM,gBAAkC,MAAM,SAAS,SACrD,QAAQ,KAAK,YAAY;EACvB,UAAU,KAAK;EACf,QAAQ,KAAK;EACb,WAAW,KAAK;EAChB,UAAU,KAAK;EACf;EACD,EAAE,CACJ;CAED,IAAI;AACJ,KAAI;AACF,kBAAgB,MAAM,8BAA8B,IAAI,cAAc;SAChE;AACN,SAAO;GAAE,gBAAgB;GAAO,cAAc,EAAE;GAAE;;CAGpD,MAAM,iBAAkC,EAAE;CAC1C,MAAM,eAAgC,EAAE;AAExC,MAAK,MAAM,QAAQ,MAYjB,KAXuB,QAAQ,OAAO,WACpC,cAAc,IACZ,sBAAsB;EACpB,UAAU,KAAK;EACf,QAAQ,KAAK;EACb,WAAW,KAAK;EAChB;EACD,CAAC,CACH,CAGe,CAChB,cAAa,KAAK,KAAK;KAEvB,gBAAe,KAAK,KAAK;AAI7B,QAAO;EAAE;EAAgB;EAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { GT } from 'generaltranslation';
|
|
2
1
|
import type { FileProperties } from '../../types/files.js';
|
|
3
|
-
|
|
2
|
+
import type { ApiClient } from '../../utils/api.js';
|
|
3
|
+
export type QueryCompletedTranslationsClient = Pick<ApiClient, 'queryFileData'>;
|
|
4
4
|
export declare function getFileTranslationKey(file: Pick<FileProperties, 'branchId' | 'fileId' | 'versionId' | 'locale'>): string;
|
|
5
|
-
export declare function queryCompletedTranslationKeys(
|
|
5
|
+
export declare function queryCompletedTranslationKeys(api: QueryCompletedTranslationsClient, fileQueryData: FileProperties[]): Promise<Set<string>>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
function getFileTranslationKey(file) {
|
|
3
3
|
return `${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`;
|
|
4
4
|
}
|
|
5
|
-
async function queryCompletedTranslationKeys(
|
|
5
|
+
async function queryCompletedTranslationKeys(api, fileQueryData) {
|
|
6
6
|
if (fileQueryData.length === 0) return /* @__PURE__ */ new Set();
|
|
7
|
-
const fileData = await
|
|
7
|
+
const fileData = await api.queryFileData({ translatedFiles: fileQueryData.map((file) => ({
|
|
8
8
|
fileId: file.fileId,
|
|
9
9
|
versionId: file.versionId,
|
|
10
10
|
branchId: file.branchId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryCompletedTranslations.js","names":[],"sources":["../../../src/workflows/utils/queryCompletedTranslations.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"queryCompletedTranslations.js","names":[],"sources":["../../../src/workflows/utils/queryCompletedTranslations.ts"],"sourcesContent":["import type { FileProperties } from '../../types/files.js';\nimport type { ApiClient } from '../../utils/api.js';\n\nexport type QueryCompletedTranslationsClient = Pick<ApiClient, 'queryFileData'>;\n\nexport function getFileTranslationKey(\n file: Pick<FileProperties, 'branchId' | 'fileId' | 'versionId' | 'locale'>\n): string {\n return `${file.branchId}:${file.fileId}:${file.versionId}:${file.locale}`;\n}\n\nexport async function queryCompletedTranslationKeys(\n api: QueryCompletedTranslationsClient,\n fileQueryData: FileProperties[]\n): Promise<Set<string>> {\n if (fileQueryData.length === 0) {\n return new Set();\n }\n\n const fileData = await api.queryFileData({\n translatedFiles: fileQueryData.map((file) => ({\n fileId: file.fileId,\n versionId: file.versionId,\n branchId: file.branchId,\n locale: file.locale,\n })),\n });\n\n return new Set(\n (fileData.translatedFiles || [])\n .filter((file) => !!file.completedAt)\n .map(getFileTranslationKey)\n );\n}\n"],"mappings":";AAKA,SAAgB,sBACd,MACQ;AACR,QAAO,GAAG,KAAK,SAAS,GAAG,KAAK,OAAO,GAAG,KAAK,UAAU,GAAG,KAAK;;AAGnE,eAAsB,8BACpB,KACA,eACsB;AACtB,KAAI,cAAc,WAAW,EAC3B,wBAAO,IAAI,KAAK;CAGlB,MAAM,WAAW,MAAM,IAAI,cAAc,EACvC,iBAAiB,cAAc,KAAK,UAAU;EAC5C,QAAQ,KAAK;EACb,WAAW,KAAK;EAChB,UAAU,KAAK;EACf,QAAQ,KAAK;EACd,EAAE,EACJ,CAAC;AAEF,QAAO,IAAI,KACR,SAAS,mBAAmB,EAAE,EAC5B,QAAQ,SAAS,CAAC,CAAC,KAAK,YAAY,CACpC,IAAI,sBAAsB,CAC9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "bin/main.js",
|
|
6
6
|
"files": [
|
|
@@ -117,10 +117,10 @@
|
|
|
117
117
|
"yaml": "^2.8.0",
|
|
118
118
|
"@generaltranslation/icu": "0.1.2",
|
|
119
119
|
"@generaltranslation/format": "0.1.8",
|
|
120
|
-
"@generaltranslation/python-extractor": "0.2.
|
|
121
|
-
"@generaltranslation/supported-locales": "2.1.
|
|
122
|
-
"@generaltranslation/vue-extractor": "0.1.
|
|
123
|
-
"generaltranslation": "9.
|
|
120
|
+
"@generaltranslation/python-extractor": "0.2.47",
|
|
121
|
+
"@generaltranslation/supported-locales": "2.1.27",
|
|
122
|
+
"@generaltranslation/vue-extractor": "0.1.7",
|
|
123
|
+
"generaltranslation": "9.2.0",
|
|
124
124
|
"gt-remark": "1.0.12"
|
|
125
125
|
},
|
|
126
126
|
"devDependencies": {
|