gtx-cli 2.6.31 → 2.7.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.
Files changed (348) hide show
  1. package/CHANGELOG.md +4 -1261
  2. package/README.md +12 -3
  3. package/dist/bin/bin-entry.js +2 -1
  4. package/dist/config/generateSettings.d.ts +1 -9
  5. package/dist/config/generateSettings.js +1 -214
  6. package/dist/config/resolveConfig.d.ts +1 -4
  7. package/dist/config/resolveConfig.js +1 -33
  8. package/dist/fs/config/setupConfig.d.ts +1 -17
  9. package/dist/fs/config/setupConfig.js +1 -50
  10. package/dist/fs/matchFiles.d.ts +1 -1
  11. package/dist/fs/matchFiles.js +1 -8
  12. package/dist/functions.d.ts +1 -7
  13. package/dist/functions.js +1 -6
  14. package/dist/index.d.ts +1 -4
  15. package/dist/index.js +1 -27
  16. package/dist/main.js +2 -2
  17. package/dist/next/parse/handleInitGT.d.ts +1 -7
  18. package/dist/next/parse/handleInitGT.js +1 -157
  19. package/dist/next/parse/wrapContent.d.ts +1 -12
  20. package/dist/next/parse/wrapContent.js +1 -164
  21. package/dist/react/parse/wrapContent.d.ts +1 -12
  22. package/dist/react/parse/wrapContent.js +1 -162
  23. package/dist/types/index.d.ts +1 -243
  24. package/dist/types/index.js +1 -1
  25. package/dist/utils/installPackage.d.ts +1 -3
  26. package/dist/utils/installPackage.js +1 -77
  27. package/dist/utils/packageInfo.d.ts +1 -3
  28. package/dist/utils/packageInfo.js +1 -17
  29. package/dist/utils/packageJson.d.ts +1 -6
  30. package/dist/utils/packageJson.js +1 -68
  31. package/dist/utils/packageManager.d.ts +1 -28
  32. package/dist/utils/packageManager.js +1 -269
  33. package/package.json +11 -97
  34. package/dist/api/collectUserEditDiffs.d.ts +0 -9
  35. package/dist/api/collectUserEditDiffs.js +0 -159
  36. package/dist/api/downloadFileBatch.d.ts +0 -23
  37. package/dist/api/downloadFileBatch.js +0 -190
  38. package/dist/api/saveLocalEdits.d.ts +0 -6
  39. package/dist/api/saveLocalEdits.js +0 -38
  40. package/dist/cli/base.d.ts +0 -59
  41. package/dist/cli/base.js +0 -529
  42. package/dist/cli/commands/download.d.ts +0 -8
  43. package/dist/cli/commands/download.js +0 -51
  44. package/dist/cli/commands/enqueue.d.ts +0 -9
  45. package/dist/cli/commands/enqueue.js +0 -27
  46. package/dist/cli/commands/setupProject.d.ts +0 -7
  47. package/dist/cli/commands/setupProject.js +0 -37
  48. package/dist/cli/commands/stage.d.ts +0 -9
  49. package/dist/cli/commands/stage.js +0 -59
  50. package/dist/cli/commands/translate.d.ts +0 -7
  51. package/dist/cli/commands/translate.js +0 -70
  52. package/dist/cli/commands/upload.d.ts +0 -13
  53. package/dist/cli/commands/upload.js +0 -142
  54. package/dist/cli/commands/utils/validation.d.ts +0 -13
  55. package/dist/cli/commands/utils/validation.js +0 -38
  56. package/dist/cli/flags.d.ts +0 -15
  57. package/dist/cli/flags.js +0 -70
  58. package/dist/cli/inline.d.ts +0 -17
  59. package/dist/cli/inline.js +0 -135
  60. package/dist/cli/next.d.ts +0 -10
  61. package/dist/cli/next.js +0 -12
  62. package/dist/cli/node.d.ts +0 -10
  63. package/dist/cli/node.js +0 -9
  64. package/dist/cli/react.d.ts +0 -12
  65. package/dist/cli/react.js +0 -72
  66. package/dist/config/optionPresets.d.ts +0 -3
  67. package/dist/config/optionPresets.js +0 -65
  68. package/dist/config/utils.d.ts +0 -2
  69. package/dist/config/utils.js +0 -4
  70. package/dist/config/validateSettings.d.ts +0 -3
  71. package/dist/config/validateSettings.js +0 -32
  72. package/dist/console/colors.d.ts +0 -6
  73. package/dist/console/colors.js +0 -19
  74. package/dist/console/displayTranslateSummary.d.ts +0 -1
  75. package/dist/console/displayTranslateSummary.js +0 -42
  76. package/dist/console/formatting.d.ts +0 -1
  77. package/dist/console/formatting.js +0 -7
  78. package/dist/console/index.d.ts +0 -34
  79. package/dist/console/index.js +0 -46
  80. package/dist/console/logger.d.ts +0 -35
  81. package/dist/console/logger.js +0 -250
  82. package/dist/console/logging.d.ts +0 -52
  83. package/dist/console/logging.js +0 -175
  84. package/dist/formats/files/aggregateFiles.d.ts +0 -4
  85. package/dist/formats/files/aggregateFiles.js +0 -156
  86. package/dist/formats/files/collectFiles.d.ts +0 -6
  87. package/dist/formats/files/collectFiles.js +0 -49
  88. package/dist/formats/files/convertToFileTranslationData.d.ts +0 -15
  89. package/dist/formats/files/convertToFileTranslationData.js +0 -21
  90. package/dist/formats/files/fileMapping.d.ts +0 -11
  91. package/dist/formats/files/fileMapping.js +0 -115
  92. package/dist/formats/files/preprocess/mdx.d.ts +0 -6
  93. package/dist/formats/files/preprocess/mdx.js +0 -14
  94. package/dist/formats/files/preprocess/mintlify.d.ts +0 -5
  95. package/dist/formats/files/preprocess/mintlify.js +0 -15
  96. package/dist/formats/files/preprocessContent.d.ts +0 -8
  97. package/dist/formats/files/preprocessContent.js +0 -23
  98. package/dist/formats/files/save.d.ts +0 -5
  99. package/dist/formats/files/save.js +0 -17
  100. package/dist/formats/files/supportedFiles.d.ts +0 -11
  101. package/dist/formats/files/supportedFiles.js +0 -20
  102. package/dist/formats/json/extractJson.d.ts +0 -15
  103. package/dist/formats/json/extractJson.js +0 -101
  104. package/dist/formats/json/flattenJson.d.ts +0 -14
  105. package/dist/formats/json/flattenJson.js +0 -64
  106. package/dist/formats/json/mergeJson.d.ts +0 -13
  107. package/dist/formats/json/mergeJson.js +0 -367
  108. package/dist/formats/json/parseJson.d.ts +0 -2
  109. package/dist/formats/json/parseJson.js +0 -109
  110. package/dist/formats/json/utils.d.ts +0 -47
  111. package/dist/formats/json/utils.js +0 -150
  112. package/dist/formats/utils.d.ts +0 -2
  113. package/dist/formats/utils.js +0 -24
  114. package/dist/formats/yaml/mergeYaml.d.ts +0 -5
  115. package/dist/formats/yaml/mergeYaml.js +0 -61
  116. package/dist/formats/yaml/parseYaml.d.ts +0 -5
  117. package/dist/formats/yaml/parseYaml.js +0 -24
  118. package/dist/formats/yaml/utils.d.ts +0 -2
  119. package/dist/formats/yaml/utils.js +0 -23
  120. package/dist/fs/clearLocaleDirs.d.ts +0 -8
  121. package/dist/fs/clearLocaleDirs.js +0 -126
  122. package/dist/fs/config/downloadedVersions.d.ts +0 -21
  123. package/dist/fs/config/downloadedVersions.js +0 -50
  124. package/dist/fs/config/loadConfig.d.ts +0 -1
  125. package/dist/fs/config/loadConfig.js +0 -9
  126. package/dist/fs/config/parseFilesConfig.d.ts +0 -27
  127. package/dist/fs/config/parseFilesConfig.js +0 -150
  128. package/dist/fs/config/updateConfig.d.ts +0 -21
  129. package/dist/fs/config/updateConfig.js +0 -57
  130. package/dist/fs/config/updateVersions.d.ts +0 -11
  131. package/dist/fs/config/updateVersions.js +0 -30
  132. package/dist/fs/copyFile.d.ts +0 -7
  133. package/dist/fs/copyFile.js +0 -39
  134. package/dist/fs/createLoadTranslationsFile.d.ts +0 -1
  135. package/dist/fs/createLoadTranslationsFile.js +0 -49
  136. package/dist/fs/determineFramework.d.ts +0 -5
  137. package/dist/fs/determineFramework.js +0 -53
  138. package/dist/fs/findFilepath.d.ts +0 -36
  139. package/dist/fs/findFilepath.js +0 -90
  140. package/dist/fs/index.d.ts +0 -1
  141. package/dist/fs/index.js +0 -1
  142. package/dist/fs/loadJSON.d.ts +0 -6
  143. package/dist/fs/loadJSON.js +0 -17
  144. package/dist/fs/saveJSON.d.ts +0 -1
  145. package/dist/fs/saveJSON.js +0 -7
  146. package/dist/fs/utils.d.ts +0 -1
  147. package/dist/fs/utils.js +0 -16
  148. package/dist/generated/version.d.ts +0 -1
  149. package/dist/generated/version.js +0 -2
  150. package/dist/git/branches.d.ts +0 -7
  151. package/dist/git/branches.js +0 -88
  152. package/dist/hooks/postProcess.d.ts +0 -4
  153. package/dist/hooks/postProcess.js +0 -110
  154. package/dist/locadex/setupFlow.d.ts +0 -2
  155. package/dist/locadex/setupFlow.js +0 -9
  156. package/dist/next/config/parseNextConfig.d.ts +0 -10
  157. package/dist/next/config/parseNextConfig.js +0 -53
  158. package/dist/next/jsx/utils.d.ts +0 -7
  159. package/dist/next/jsx/utils.js +0 -42
  160. package/dist/react/config/createESBuildConfig.d.ts +0 -2
  161. package/dist/react/config/createESBuildConfig.js +0 -119
  162. package/dist/react/jsx/evaluateJsx.d.ts +0 -24
  163. package/dist/react/jsx/evaluateJsx.js +0 -123
  164. package/dist/react/jsx/utils/buildImportMap.d.ts +0 -9
  165. package/dist/react/jsx/utils/buildImportMap.js +0 -30
  166. package/dist/react/jsx/utils/constants.d.ts +0 -15
  167. package/dist/react/jsx/utils/constants.js +0 -49
  168. package/dist/react/jsx/utils/getCalleeNameFromExpression.d.ts +0 -9
  169. package/dist/react/jsx/utils/getCalleeNameFromExpression.js +0 -32
  170. package/dist/react/jsx/utils/getPathsAndAliases.d.ts +0 -21
  171. package/dist/react/jsx/utils/getPathsAndAliases.js +0 -91
  172. package/dist/react/jsx/utils/isNumberLiteral.d.ts +0 -7
  173. package/dist/react/jsx/utils/isNumberLiteral.js +0 -13
  174. package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.d.ts +0 -9
  175. package/dist/react/jsx/utils/jsxParsing/addGTIdentifierToSyntaxTree.js +0 -138
  176. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.d.ts +0 -6
  177. package/dist/react/jsx/utils/jsxParsing/handleChildrenWhitespace.js +0 -197
  178. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.d.ts +0 -13
  179. package/dist/react/jsx/utils/jsxParsing/multiplication/findMultiplicationNode.js +0 -42
  180. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.d.ts +0 -5
  181. package/dist/react/jsx/utils/jsxParsing/multiplication/multiplyJsxTree.js +0 -69
  182. package/dist/react/jsx/utils/jsxParsing/parseJsx.d.ts +0 -33
  183. package/dist/react/jsx/utils/jsxParsing/parseJsx.js +0 -918
  184. package/dist/react/jsx/utils/jsxParsing/parseTProps.d.ts +0 -8
  185. package/dist/react/jsx/utils/jsxParsing/parseTProps.js +0 -65
  186. package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.d.ts +0 -2
  187. package/dist/react/jsx/utils/jsxParsing/removeNullChildrenFields.js +0 -61
  188. package/dist/react/jsx/utils/jsxParsing/types.d.ts +0 -48
  189. package/dist/react/jsx/utils/jsxParsing/types.js +0 -34
  190. package/dist/react/jsx/utils/mapAttributeName.d.ts +0 -11
  191. package/dist/react/jsx/utils/mapAttributeName.js +0 -12
  192. package/dist/react/jsx/utils/parseAst.d.ts +0 -31
  193. package/dist/react/jsx/utils/parseAst.js +0 -278
  194. package/dist/react/jsx/utils/parseDeclareStatic.d.ts +0 -15
  195. package/dist/react/jsx/utils/parseDeclareStatic.js +0 -540
  196. package/dist/react/jsx/utils/parseString.d.ts +0 -25
  197. package/dist/react/jsx/utils/parseString.js +0 -540
  198. package/dist/react/jsx/utils/parseStringFunction.d.ts +0 -30
  199. package/dist/react/jsx/utils/parseStringFunction.js +0 -348
  200. package/dist/react/jsx/utils/resolveImportPath.d.ts +0 -11
  201. package/dist/react/jsx/utils/resolveImportPath.js +0 -111
  202. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.d.ts +0 -29
  203. package/dist/react/jsx/utils/stringParsing/processTranslationCall/extractStringEntryMetadata.js +0 -86
  204. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.d.ts +0 -14
  205. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleInvalidTranslationCall.js +0 -24
  206. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.d.ts +0 -19
  207. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleLiteralTranslationCall.js +0 -31
  208. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleStaticTranslationCall.d.ts +0 -22
  209. package/dist/react/jsx/utils/stringParsing/processTranslationCall/handleStaticTranslationCall.js +0 -51
  210. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.d.ts +0 -18
  211. package/dist/react/jsx/utils/stringParsing/processTranslationCall/index.js +0 -39
  212. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.d.ts +0 -24
  213. package/dist/react/jsx/utils/stringParsing/processTranslationCall/routeTranslationCall.js +0 -68
  214. package/dist/react/jsx/utils/stringParsing/types.d.ts +0 -41
  215. package/dist/react/jsx/utils/stringParsing/types.js +0 -1
  216. package/dist/react/jsx/utils/types.d.ts +0 -14
  217. package/dist/react/jsx/utils/types.js +0 -1
  218. package/dist/react/jsx/utils/validateStringFunction.d.ts +0 -7
  219. package/dist/react/jsx/utils/validateStringFunction.js +0 -31
  220. package/dist/react/jsx/wrapJsx.d.ts +0 -51
  221. package/dist/react/jsx/wrapJsx.js +0 -387
  222. package/dist/react/parse/addVitePlugin/index.d.ts +0 -22
  223. package/dist/react/parse/addVitePlugin/index.js +0 -41
  224. package/dist/react/parse/addVitePlugin/installCompiler.d.ts +0 -8
  225. package/dist/react/parse/addVitePlugin/installCompiler.js +0 -22
  226. package/dist/react/parse/addVitePlugin/updateViteConfig.d.ts +0 -19
  227. package/dist/react/parse/addVitePlugin/updateViteConfig.js +0 -120
  228. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.d.ts +0 -9
  229. package/dist/react/parse/addVitePlugin/utils/addCompilerImport.js +0 -34
  230. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.d.ts +0 -11
  231. package/dist/react/parse/addVitePlugin/utils/addPluginInvocation.js +0 -48
  232. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.d.ts +0 -15
  233. package/dist/react/parse/addVitePlugin/utils/checkCompilerImport.js +0 -113
  234. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.d.ts +0 -12
  235. package/dist/react/parse/addVitePlugin/utils/checkPluginInvocation.js +0 -32
  236. package/dist/react/parse/createDictionaryUpdates.d.ts +0 -3
  237. package/dist/react/parse/createDictionaryUpdates.js +0 -187
  238. package/dist/react/parse/createInlineUpdates.d.ts +0 -13
  239. package/dist/react/parse/createInlineUpdates.js +0 -161
  240. package/dist/react/utils/flattenDictionary.d.ts +0 -20
  241. package/dist/react/utils/flattenDictionary.js +0 -75
  242. package/dist/react/utils/getEntryAndMetadata.d.ts +0 -5
  243. package/dist/react/utils/getEntryAndMetadata.js +0 -11
  244. package/dist/react/utils/getVariableName.d.ts +0 -25
  245. package/dist/react/utils/getVariableName.js +0 -37
  246. package/dist/setup/agentInstructions.d.ts +0 -24
  247. package/dist/setup/agentInstructions.js +0 -138
  248. package/dist/setup/detectFramework.d.ts +0 -31
  249. package/dist/setup/detectFramework.js +0 -106
  250. package/dist/setup/frameworkUtils.d.ts +0 -3
  251. package/dist/setup/frameworkUtils.js +0 -30
  252. package/dist/setup/instructions/base.md +0 -29
  253. package/dist/setup/instructions/gt-next.md +0 -107
  254. package/dist/setup/instructions/gt-react.md +0 -98
  255. package/dist/setup/userInput.d.ts +0 -4
  256. package/dist/setup/userInput.js +0 -32
  257. package/dist/setup/wizard.d.ts +0 -3
  258. package/dist/setup/wizard.js +0 -147
  259. package/dist/state/recentDownloads.d.ts +0 -12
  260. package/dist/state/recentDownloads.js +0 -18
  261. package/dist/state/translateWarnings.d.ts +0 -10
  262. package/dist/state/translateWarnings.js +0 -13
  263. package/dist/translation/parse.d.ts +0 -17
  264. package/dist/translation/parse.js +0 -77
  265. package/dist/translation/stage.d.ts +0 -3
  266. package/dist/translation/stage.js +0 -44
  267. package/dist/translation/validate.d.ts +0 -14
  268. package/dist/translation/validate.js +0 -100
  269. package/dist/types/branch.d.ts +0 -14
  270. package/dist/types/branch.js +0 -1
  271. package/dist/types/data/json.d.ts +0 -6
  272. package/dist/types/data/json.js +0 -1
  273. package/dist/types/data.d.ts +0 -37
  274. package/dist/types/data.js +0 -1
  275. package/dist/types/files.d.ts +0 -8
  276. package/dist/types/files.js +0 -1
  277. package/dist/types/libraries.d.ts +0 -31
  278. package/dist/types/libraries.js +0 -72
  279. package/dist/types/parsing.d.ts +0 -3
  280. package/dist/types/parsing.js +0 -1
  281. package/dist/utils/addExplicitAnchorIds.d.ts +0 -24
  282. package/dist/utils/addExplicitAnchorIds.js +0 -416
  283. package/dist/utils/constants.d.ts +0 -5
  284. package/dist/utils/constants.js +0 -6
  285. package/dist/utils/credentials.d.ts +0 -12
  286. package/dist/utils/credentials.js +0 -120
  287. package/dist/utils/flattenJsonFiles.d.ts +0 -2
  288. package/dist/utils/flattenJsonFiles.js +0 -36
  289. package/dist/utils/gitDiff.d.ts +0 -8
  290. package/dist/utils/gitDiff.js +0 -34
  291. package/dist/utils/gt.d.ts +0 -2
  292. package/dist/utils/gt.js +0 -2
  293. package/dist/utils/hash.d.ts +0 -6
  294. package/dist/utils/hash.js +0 -11
  295. package/dist/utils/headers.d.ts +0 -1
  296. package/dist/utils/headers.js +0 -14
  297. package/dist/utils/localizeRelativeAssets.d.ts +0 -8
  298. package/dist/utils/localizeRelativeAssets.js +0 -166
  299. package/dist/utils/localizeStaticImports.d.ts +0 -15
  300. package/dist/utils/localizeStaticImports.js +0 -397
  301. package/dist/utils/localizeStaticUrls.d.ts +0 -19
  302. package/dist/utils/localizeStaticUrls.js +0 -450
  303. package/dist/utils/mintlifyTitleFallback.d.ts +0 -6
  304. package/dist/utils/mintlifyTitleFallback.js +0 -80
  305. package/dist/utils/parse/needsCJS.d.ts +0 -20
  306. package/dist/utils/parse/needsCJS.js +0 -72
  307. package/dist/utils/persistPostprocessHashes.d.ts +0 -12
  308. package/dist/utils/persistPostprocessHashes.js +0 -39
  309. package/dist/utils/processAnchorIds.d.ts +0 -6
  310. package/dist/utils/processAnchorIds.js +0 -56
  311. package/dist/utils/processOpenApi.d.ts +0 -8
  312. package/dist/utils/processOpenApi.js +0 -651
  313. package/dist/utils/sanitizeFileContent.d.ts +0 -6
  314. package/dist/utils/sanitizeFileContent.js +0 -29
  315. package/dist/utils/sharedStaticAssets.d.ts +0 -9
  316. package/dist/utils/sharedStaticAssets.js +0 -384
  317. package/dist/utils/validateMdx.d.ts +0 -10
  318. package/dist/utils/validateMdx.js +0 -25
  319. package/dist/utils/wrapPlainUrls.d.ts +0 -8
  320. package/dist/utils/wrapPlainUrls.js +0 -72
  321. package/dist/workflows/download.d.ts +0 -32
  322. package/dist/workflows/download.js +0 -131
  323. package/dist/workflows/enqueue.d.ts +0 -17
  324. package/dist/workflows/enqueue.js +0 -59
  325. package/dist/workflows/setupProject.d.ts +0 -13
  326. package/dist/workflows/setupProject.js +0 -48
  327. package/dist/workflows/stage.d.ts +0 -18
  328. package/dist/workflows/stage.js +0 -59
  329. package/dist/workflows/steps/BranchStep.d.ts +0 -13
  330. package/dist/workflows/steps/BranchStep.js +0 -161
  331. package/dist/workflows/steps/DownloadStep.d.ts +0 -19
  332. package/dist/workflows/steps/DownloadStep.js +0 -131
  333. package/dist/workflows/steps/EnqueueStep.d.ts +0 -15
  334. package/dist/workflows/steps/EnqueueStep.js +0 -33
  335. package/dist/workflows/steps/PollJobsStep.d.ts +0 -31
  336. package/dist/workflows/steps/PollJobsStep.js +0 -288
  337. package/dist/workflows/steps/SetupStep.d.ts +0 -16
  338. package/dist/workflows/steps/SetupStep.js +0 -72
  339. package/dist/workflows/steps/UploadSourcesStep.d.ts +0 -27
  340. package/dist/workflows/steps/UploadSourcesStep.js +0 -131
  341. package/dist/workflows/steps/UploadTranslationsStep.d.ts +0 -22
  342. package/dist/workflows/steps/UploadTranslationsStep.js +0 -71
  343. package/dist/workflows/steps/UserEditDiffsStep.d.ts +0 -11
  344. package/dist/workflows/steps/UserEditDiffsStep.js +0 -30
  345. package/dist/workflows/steps/WorkflowStep.d.ts +0 -4
  346. package/dist/workflows/steps/WorkflowStep.js +0 -2
  347. package/dist/workflows/upload.d.ts +0 -15
  348. package/dist/workflows/upload.js +0 -47
@@ -1,288 +0,0 @@
1
- import chalk from 'chalk';
2
- import { WorkflowStep } from './WorkflowStep.js';
3
- import { logger } from '../../console/logger.js';
4
- import { TEMPLATE_FILE_NAME } from '../../utils/constants.js';
5
- export class PollTranslationJobsStep extends WorkflowStep {
6
- gt;
7
- spinner = null;
8
- previousProgress = 0;
9
- constructor(gt) {
10
- super();
11
- this.gt = gt;
12
- }
13
- async run({ fileTracker, fileQueryData, jobData, timeoutDuration, forceRetranslation, }) {
14
- const startTime = Date.now();
15
- this.spinner = logger.createProgressBar(fileQueryData.length);
16
- const spinnerMessage = forceRetranslation
17
- ? 'Waiting for retranslation...'
18
- : 'Waiting for translation...';
19
- this.spinner.start(spinnerMessage);
20
- // Build a map of branchId:fileId:versionId:locale -> FileProperties
21
- const filePropertiesMap = new Map();
22
- fileQueryData.forEach((item) => {
23
- filePropertiesMap.set(`${item.branchId}:${item.fileId}:${item.versionId}:${item.locale}`, item);
24
- });
25
- // Initial query to check which files already have translations
26
- const initialFileData = await this.gt.queryFileData({
27
- translatedFiles: fileQueryData.map((item) => ({
28
- fileId: item.fileId,
29
- versionId: item.versionId,
30
- branchId: item.branchId,
31
- locale: item.locale,
32
- })),
33
- });
34
- const existingTranslations = initialFileData.translatedFiles || [];
35
- // Mark all existing translations as completed
36
- existingTranslations.forEach((translation) => {
37
- if (!translation.completedAt) {
38
- return;
39
- }
40
- const fileKey = `${translation.branchId}:${translation.fileId}:${translation.versionId}:${translation.locale}`;
41
- const fileProperties = filePropertiesMap.get(fileKey);
42
- if (fileProperties) {
43
- fileTracker.completed.set(fileKey, fileProperties);
44
- }
45
- });
46
- // Build a map of jobs for quick lookup:
47
- // branchId:fileId:versionId:locale -> job
48
- const jobMap = new Map();
49
- Object.entries(jobData.jobData).forEach(([jobId, job]) => {
50
- const jobLocale = this.gt.resolveAliasLocale(job.targetLocale);
51
- const key = `${job.branchId}:${job.fileId}:${job.versionId}:${jobLocale}`;
52
- jobMap.set(key, { ...job, jobId, targetLocale: jobLocale });
53
- });
54
- // Build a map of jobs for quick lookup:
55
- // jobId -> file data for the job
56
- const jobFileMap = new Map();
57
- Object.entries(jobData.jobData).forEach(([jobId, job]) => {
58
- const jobLocale = this.gt.resolveAliasLocale(job.targetLocale);
59
- jobFileMap.set(jobId, {
60
- branchId: job.branchId,
61
- fileId: job.fileId,
62
- versionId: job.versionId,
63
- locale: jobLocale,
64
- });
65
- });
66
- // Categorize each file query item
67
- for (const item of fileQueryData) {
68
- const fileKey = `${item.branchId}:${item.fileId}:${item.versionId}:${item.locale}`;
69
- // Check if translation already exists (completedAt is truthy)
70
- const existingTranslation = fileTracker.completed.get(fileKey);
71
- if (existingTranslation) {
72
- continue;
73
- }
74
- // Check if there's a job for this file
75
- const jobKey = `${item.branchId}:${item.fileId}:${item.versionId}:${item.locale}`;
76
- const job = jobMap.get(jobKey);
77
- if (job) {
78
- // Job exists - mark as in progress initially
79
- fileTracker.inProgress.set(fileKey, item);
80
- }
81
- else {
82
- // No job and no existing translation - mark as skipped
83
- fileTracker.skipped.set(fileKey, item);
84
- }
85
- }
86
- // Update spinner with initial status
87
- this.updateSpinner(fileTracker, fileQueryData);
88
- // If force retranslation, don't skip the initial check
89
- if (!forceRetranslation) {
90
- // Check if all jobs are already complete
91
- if (fileTracker.inProgress.size === 0) {
92
- this.spinner.stop(chalk.green('All translations ready'));
93
- return { success: true, fileTracker };
94
- }
95
- }
96
- // Calculate time until next 5-second interval since startTime
97
- const msUntilNextInterval = Math.max(0, 5000 - ((Date.now() - startTime) % 5000));
98
- return new Promise((resolve) => {
99
- let intervalCheck;
100
- setTimeout(() => {
101
- intervalCheck = setInterval(async () => {
102
- try {
103
- // Query job status
104
- const jobIds = Array.from(jobFileMap.keys());
105
- const jobStatusResponse = await this.gt.checkJobStatus(jobIds);
106
- // Update status based on job completion
107
- for (const job of jobStatusResponse) {
108
- const jobFileProperties = jobFileMap.get(job.jobId);
109
- if (jobFileProperties) {
110
- const fileKey = `${jobFileProperties.branchId}:${jobFileProperties.fileId}:${jobFileProperties.versionId}:${jobFileProperties.locale}`;
111
- const fileProperties = filePropertiesMap.get(fileKey);
112
- if (!fileProperties) {
113
- continue;
114
- }
115
- if (job.status === 'completed') {
116
- fileTracker.completed.set(fileKey, fileProperties);
117
- fileTracker.inProgress.delete(fileKey);
118
- jobFileMap.delete(job.jobId);
119
- }
120
- else if (job.status === 'failed') {
121
- fileTracker.failed.set(fileKey, fileProperties);
122
- fileTracker.inProgress.delete(fileKey);
123
- jobFileMap.delete(job.jobId);
124
- }
125
- else if (job.status === 'unknown') {
126
- fileTracker.skipped.set(fileKey, fileProperties);
127
- fileTracker.inProgress.delete(fileKey);
128
- jobFileMap.delete(job.jobId);
129
- }
130
- }
131
- }
132
- // Update spinner
133
- this.updateSpinner(fileTracker, fileQueryData);
134
- const elapsed = Date.now() - startTime;
135
- const allJobsProcessed = fileTracker.inProgress.size === 0;
136
- if (allJobsProcessed || elapsed >= timeoutDuration * 1000) {
137
- clearInterval(intervalCheck);
138
- if (fileTracker.inProgress.size === 0) {
139
- this.spinner.stop(chalk.green('Translation jobs finished'));
140
- resolve({ success: true, fileTracker });
141
- }
142
- else {
143
- this.spinner.stop(chalk.red('Timed out waiting for translation jobs'));
144
- resolve({ success: false, fileTracker });
145
- }
146
- }
147
- }
148
- catch (error) {
149
- logger.error(chalk.red('Error checking job status: ') + error);
150
- }
151
- }, 5000);
152
- }, msUntilNextInterval);
153
- });
154
- }
155
- updateSpinner(fileTracker, fileQueryData) {
156
- if (!this.spinner)
157
- return;
158
- const statusText = this.generateStatusSuffixText(fileTracker, fileQueryData);
159
- const currentProgress = fileTracker.completed.size +
160
- fileTracker.failed.size +
161
- fileTracker.skipped.size;
162
- const progressDelta = currentProgress - this.previousProgress;
163
- this.spinner.advance(progressDelta, statusText);
164
- this.previousProgress = currentProgress;
165
- }
166
- generateStatusSuffixText(fileTracker, fileQueryData) {
167
- // Simple progress indicator
168
- const progressText = `${chalk.green(`[${fileTracker.completed.size +
169
- fileTracker.failed.size +
170
- fileTracker.skipped.size}/${fileQueryData.length}]`)} translations completed`;
171
- // Get terminal height to adapt our output
172
- const terminalHeight = process.stdout.rows || 24;
173
- // If terminal is very small, just show the basic progress
174
- if (terminalHeight < 6) {
175
- return progressText;
176
- }
177
- const newSuffixText = [progressText];
178
- // Organize data by filename : locale
179
- const fileStatus = new Map();
180
- // Initialize with all files and locales from fileQueryData
181
- for (const item of fileQueryData) {
182
- if (!fileStatus.has(item.fileName)) {
183
- fileStatus.set(item.fileName, {
184
- completed: new Set(),
185
- pending: new Set([item.locale]),
186
- failed: new Set(),
187
- skipped: new Set(),
188
- });
189
- }
190
- else {
191
- fileStatus.get(item.fileName)?.pending.add(item.locale);
192
- }
193
- }
194
- // Mark which ones are completed, failed, or skipped
195
- for (const [_, fileProperties] of fileTracker.completed) {
196
- const { fileName, locale } = fileProperties;
197
- const status = fileStatus.get(fileName);
198
- if (status) {
199
- status.pending.delete(locale);
200
- status.completed.add(locale);
201
- }
202
- }
203
- for (const [_, fileProperties] of fileTracker.failed) {
204
- const { fileName, locale } = fileProperties;
205
- const status = fileStatus.get(fileName);
206
- if (status) {
207
- status.pending.delete(locale);
208
- status.failed.add(locale);
209
- }
210
- }
211
- for (const [_, fileProperties] of fileTracker.skipped) {
212
- const { fileName, locale } = fileProperties;
213
- const status = fileStatus.get(fileName);
214
- if (status) {
215
- status.pending.delete(locale);
216
- status.skipped.add(locale);
217
- }
218
- }
219
- // Calculate how many files we can show based on terminal height
220
- const filesArray = Array.from(fileStatus.entries());
221
- const maxFilesToShow = Math.min(filesArray.length, terminalHeight - 3 // Header + progress + buffer
222
- );
223
- // Display each file with its status on a single line
224
- for (let i = 0; i < maxFilesToShow; i++) {
225
- const [fileName, status] = filesArray[i];
226
- // Create condensed locale status
227
- const localeStatuses = [];
228
- // Add completed locales (green)
229
- if (status.completed.size > 0) {
230
- localeStatuses.push(...Array.from(status.completed).map((locale) => ({
231
- locale,
232
- status: 'completed',
233
- })));
234
- }
235
- // Add skipped locales (green)
236
- if (status.skipped.size > 0) {
237
- localeStatuses.push(...Array.from(status.skipped).map((locale) => ({
238
- locale,
239
- status: 'skipped',
240
- })));
241
- }
242
- // Add failed locales (red)
243
- if (status.failed.size > 0) {
244
- localeStatuses.push(...Array.from(status.failed).map((locale) => ({
245
- locale,
246
- status: 'failed',
247
- })));
248
- }
249
- // Add pending locales (yellow)
250
- if (status.pending.size > 0) {
251
- localeStatuses.push(...Array.from(status.pending).map((locale) => ({
252
- locale,
253
- status: 'pending',
254
- })));
255
- }
256
- // Sort localeStatuses by locale
257
- localeStatuses.sort((a, b) => a.locale.localeCompare(b.locale));
258
- // Add colors
259
- const localeString = localeStatuses
260
- .map((locale) => {
261
- if (locale.status === 'completed') {
262
- return chalk.green(locale.locale);
263
- }
264
- else if (locale.status === 'skipped') {
265
- return chalk.gray(locale.locale);
266
- }
267
- else if (locale.status === 'failed') {
268
- return chalk.red(locale.locale);
269
- }
270
- else if (locale.status === 'pending') {
271
- return chalk.yellow(locale.locale);
272
- }
273
- })
274
- .join(', ');
275
- // Format the line
276
- const prettyFileName = fileName === TEMPLATE_FILE_NAME ? '<React Elements>' : fileName;
277
- newSuffixText.push(`${chalk.bold(prettyFileName)} [${localeString}]`);
278
- }
279
- // If we couldn't show all files, add an indicator
280
- if (filesArray.length > maxFilesToShow) {
281
- newSuffixText.push(`... and ${filesArray.length - maxFilesToShow} more files`);
282
- }
283
- return newSuffixText.join('\n');
284
- }
285
- async wait() {
286
- return;
287
- }
288
- }
@@ -1,16 +0,0 @@
1
- import { FileReference } from 'generaltranslation/types';
2
- import { WorkflowStep } from './WorkflowStep.js';
3
- import { GT } from 'generaltranslation';
4
- import { Settings } from '../../types/index.js';
5
- export declare class SetupStep extends WorkflowStep<FileReference[], FileReference[]> {
6
- private gt;
7
- private settings;
8
- private timeoutMs;
9
- private spinner;
10
- private setupJobId;
11
- private files;
12
- private completed;
13
- constructor(gt: GT, settings: Settings, timeoutMs: number);
14
- run(files: FileReference[], force?: boolean): Promise<FileReference[]>;
15
- wait(): Promise<void>;
16
- }
@@ -1,72 +0,0 @@
1
- import { WorkflowStep } from './WorkflowStep.js';
2
- import { logger } from '../../console/logger.js';
3
- import chalk from 'chalk';
4
- export class SetupStep extends WorkflowStep {
5
- gt;
6
- settings;
7
- timeoutMs;
8
- spinner = logger.createSpinner('dots');
9
- setupJobId = null;
10
- files = null;
11
- completed = false;
12
- constructor(gt, settings, timeoutMs) {
13
- super();
14
- this.gt = gt;
15
- this.settings = settings;
16
- this.timeoutMs = timeoutMs;
17
- }
18
- async run(files, force = false) {
19
- this.files = files;
20
- this.spinner.start('Setting up project...');
21
- if (files.length === 0) {
22
- this.completed = true;
23
- return [];
24
- }
25
- const result = await this.gt.setupProject(files, {
26
- locales: this.settings.locales,
27
- force,
28
- });
29
- if (result.status === 'completed') {
30
- this.completed = true;
31
- return files;
32
- }
33
- if (result.status === 'queued') {
34
- this.setupJobId = result.setupJobId;
35
- return files;
36
- }
37
- // Unknown status
38
- this.completed = true;
39
- return files;
40
- }
41
- async wait() {
42
- if (this.completed) {
43
- this.spinner.stop(chalk.green('Setup successfully completed'));
44
- return;
45
- }
46
- if (!this.setupJobId) {
47
- this.spinner.stop(chalk.yellow('Setup status unknown — proceeding without setup'));
48
- return;
49
- }
50
- // Poll for completion
51
- const start = Date.now();
52
- const pollInterval = 5000; // 5 seconds
53
- while (Date.now() - start < this.timeoutMs) {
54
- const status = await this.gt.checkJobStatus([this.setupJobId]);
55
- if (!status[0]) {
56
- this.spinner.stop(chalk.yellow('Setup status unknown — proceeding without setup'));
57
- return;
58
- }
59
- if (status[0].status === 'completed') {
60
- this.spinner.stop(chalk.green('Setup successfully completed'));
61
- return;
62
- }
63
- if (status[0].status === 'failed') {
64
- this.spinner.stop(chalk.yellow(`Setup failed: ${status[0].error?.message || 'Unknown error'} — proceeding without setup`));
65
- return;
66
- }
67
- await new Promise((r) => setTimeout(r, pollInterval));
68
- }
69
- // Timeout
70
- this.spinner.stop(chalk.yellow('Setup timed out — proceeding without setup'));
71
- }
72
- }
@@ -1,27 +0,0 @@
1
- import type { FileToUpload } from 'generaltranslation/types';
2
- import { WorkflowStep } from './WorkflowStep.js';
3
- import { GT } from 'generaltranslation';
4
- import { Settings } from '../../types/index.js';
5
- import { BranchData } from '../../types/branch.js';
6
- import type { FileReference } from 'generaltranslation/types';
7
- export declare class UploadSourcesStep extends WorkflowStep<{
8
- files: FileToUpload[];
9
- branchData: BranchData;
10
- }, FileReference[]> {
11
- private gt;
12
- private settings;
13
- private spinner;
14
- private result;
15
- constructor(gt: GT, settings: Settings);
16
- /**
17
- * Detects file moves by comparing local files against orphaned files.
18
- * A move is detected when a local file has the same versionId (content hash)
19
- * as an orphaned file but a different fileId (path hash).
20
- */
21
- private detectMoves;
22
- run({ files, branchData, }: {
23
- files: FileToUpload[];
24
- branchData: BranchData;
25
- }): Promise<FileReference[]>;
26
- wait(): Promise<void>;
27
- }
@@ -1,131 +0,0 @@
1
- import { WorkflowStep } from './WorkflowStep.js';
2
- import { logger } from '../../console/logger.js';
3
- import { recordWarning } from '../../state/translateWarnings.js';
4
- import chalk from 'chalk';
5
- export class UploadSourcesStep extends WorkflowStep {
6
- gt;
7
- settings;
8
- spinner = logger.createSpinner('dots');
9
- result = null;
10
- constructor(gt, settings) {
11
- super();
12
- this.gt = gt;
13
- this.settings = settings;
14
- }
15
- /**
16
- * Detects file moves by comparing local files against orphaned files.
17
- * A move is detected when a local file has the same versionId (content hash)
18
- * as an orphaned file but a different fileId (path hash).
19
- */
20
- detectMoves(localFiles, orphanedFiles) {
21
- const moves = [];
22
- // Build a map of versionId -> orphaned file
23
- const orphansByVersionId = new Map();
24
- for (const orphan of orphanedFiles) {
25
- orphansByVersionId.set(orphan.versionId, orphan);
26
- }
27
- // Check each local file against orphaned files
28
- for (const local of localFiles) {
29
- const orphan = orphansByVersionId.get(local.versionId);
30
- if (orphan && orphan.fileId !== local.fileId) {
31
- // Same content, different path = move detected
32
- moves.push({
33
- oldFileId: orphan.fileId,
34
- newFileId: local.fileId,
35
- newFileName: local.fileName,
36
- });
37
- // Remove from map to avoid matching same orphan twice
38
- orphansByVersionId.delete(local.versionId);
39
- }
40
- }
41
- return moves;
42
- }
43
- async run({ files, branchData, }) {
44
- if (files.length === 0) {
45
- logger.info('No files to upload found... skipping upload step');
46
- return [];
47
- }
48
- const currentBranchId = branchData.currentBranch.id;
49
- this.spinner.start(`Syncing ${files.length} file${files.length !== 1 ? 's' : ''} with General Translation API...`);
50
- // Query file data and orphaned files in parallel
51
- const [fileData, orphanedFilesResult] = await Promise.all([
52
- this.gt.queryFileData({
53
- sourceFiles: files.map((f) => ({
54
- fileId: f.fileId,
55
- versionId: f.versionId,
56
- branchId: f.branchId ?? currentBranchId,
57
- })),
58
- }),
59
- this.gt.getOrphanedFiles(currentBranchId, files.map((f) => f.fileId)),
60
- ]);
61
- // Detect file moves
62
- const moves = this.detectMoves(files, orphanedFilesResult.orphanedFiles);
63
- // Track successfully moved files
64
- let successfullyMovedFileIds = new Set();
65
- // Process moves if any were detected
66
- if (moves.length > 0) {
67
- this.spinner.message(`Detected ${moves.length} moved file${moves.length !== 1 ? 's' : ''}, preserving translations...`);
68
- const moveResult = await this.gt.processFileMoves(moves, {
69
- branchId: currentBranchId,
70
- });
71
- // Only track files where the move actually succeeded
72
- successfullyMovedFileIds = new Set(moveResult.results.filter((r) => r.success).map((r) => r.newFileId));
73
- const failed = moveResult.summary.failed;
74
- if (failed > 0) {
75
- logger.warn(`Failed to migrate ${failed} moved file${failed !== 1 ? 's' : ''}`);
76
- for (const r of moveResult.results) {
77
- if (!r.success) {
78
- const move = moves.find((m) => m.newFileId === r.newFileId);
79
- recordWarning('failed_move', move?.newFileName ?? r.newFileId, r.error ?? 'Unknown error');
80
- }
81
- }
82
- }
83
- }
84
- // Build a map of branch:fileId:versionId to fileData
85
- const fileDataMap = new Map();
86
- fileData.sourceFiles?.forEach((f) => {
87
- fileDataMap.set(`${f.branchId}:${f.fileId}:${f.versionId}`, f);
88
- });
89
- // Build a list of files that need to be uploaded
90
- const filesToUpload = [];
91
- const filesToSkipUpload = [];
92
- files.forEach((f) => {
93
- const key = `${f.branchId ?? currentBranchId}:${f.fileId}:${f.versionId}`;
94
- if (fileDataMap.has(key) || successfullyMovedFileIds.has(f.fileId)) {
95
- filesToSkipUpload.push(f);
96
- }
97
- else {
98
- filesToUpload.push(f);
99
- }
100
- });
101
- const response = await this.gt.uploadSourceFiles(filesToUpload.map((f) => ({
102
- source: {
103
- ...f,
104
- branchId: f.branchId ?? currentBranchId,
105
- locale: this.settings.defaultLocale,
106
- incomingBranchId: branchData.incomingBranch?.id,
107
- checkedOutBranchId: branchData.checkedOutBranch?.id,
108
- },
109
- })), {
110
- sourceLocale: this.settings.defaultLocale,
111
- modelProvider: this.settings.modelProvider,
112
- });
113
- this.result = response.uploadedFiles;
114
- // Merge files that were already uploaded into the result
115
- this.result.push(...filesToSkipUpload.map((f) => ({
116
- fileId: f.fileId,
117
- versionId: f.versionId,
118
- branchId: f.branchId ?? currentBranchId,
119
- fileName: f.fileName,
120
- fileFormat: f.fileFormat,
121
- dataFormat: f.dataFormat,
122
- locale: f.locale,
123
- })));
124
- const moveMsg = moves.length > 0 ? ` (${moves.length} moved)` : '';
125
- this.spinner.stop(chalk.green(`Files uploaded successfully${moveMsg}`));
126
- return this.result;
127
- }
128
- async wait() {
129
- return;
130
- }
131
- }
@@ -1,22 +0,0 @@
1
- import { WorkflowStep } from './WorkflowStep.js';
2
- import { GT } from 'generaltranslation';
3
- import { Settings } from '../../types/index.js';
4
- import { BranchData } from '../../types/branch.js';
5
- import type { FileReference, FileToUpload } from 'generaltranslation/types';
6
- type UploadTranslationsInput = {
7
- files: {
8
- source: FileToUpload;
9
- translations: FileToUpload[];
10
- }[];
11
- branchData: BranchData;
12
- };
13
- export declare class UploadTranslationsStep extends WorkflowStep<UploadTranslationsInput, FileReference[]> {
14
- private gt;
15
- private settings;
16
- private spinner;
17
- private result;
18
- constructor(gt: GT, settings: Settings);
19
- run({ files, branchData, }: UploadTranslationsInput): Promise<FileReference[]>;
20
- wait(): Promise<void>;
21
- }
22
- export {};
@@ -1,71 +0,0 @@
1
- import { WorkflowStep } from './WorkflowStep.js';
2
- import { logger } from '../../console/logger.js';
3
- import chalk from 'chalk';
4
- export class UploadTranslationsStep extends WorkflowStep {
5
- gt;
6
- settings;
7
- spinner = logger.createSpinner('dots');
8
- result = [];
9
- constructor(gt, settings) {
10
- super();
11
- this.gt = gt;
12
- this.settings = settings;
13
- }
14
- async run({ files, branchData, }) {
15
- // Filter to only files that have translations
16
- const filesWithTranslations = files.filter((f) => f.translations.length > 0);
17
- if (filesWithTranslations.length === 0) {
18
- logger.info('No translation files to upload... skipping upload translations step');
19
- return [];
20
- }
21
- const totalTranslations = filesWithTranslations.reduce((acc, f) => acc + f.translations.length, 0);
22
- this.spinner.start(`Syncing ${totalTranslations} translation file${totalTranslations !== 1 ? 's' : ''} with General Translation API...`);
23
- // Build the query for existing translation files
24
- const translatedFilesQuery = filesWithTranslations.flatMap((f) => f.translations.map((t) => ({
25
- fileId: t.fileId,
26
- versionId: t.versionId,
27
- branchId: t.branchId ?? branchData.currentBranch.id,
28
- locale: t.locale,
29
- })));
30
- // Query for existing translation files
31
- const fileData = await this.gt.queryFileData({
32
- translatedFiles: translatedFilesQuery,
33
- });
34
- // Build a map of existing translations: branchId:fileId:versionId:locale
35
- const existingTranslationsMap = new Set();
36
- fileData.translatedFiles?.forEach((f) => {
37
- existingTranslationsMap.add(`${f.branchId}:${f.fileId}:${f.versionId}:${f.locale}`);
38
- });
39
- // Filter out translations that already exist
40
- const filesToUpload = filesWithTranslations
41
- .map((f) => {
42
- const newTranslations = f.translations.filter((t) => {
43
- const branchId = t.branchId ?? branchData.currentBranch.id;
44
- const key = `${branchId}:${t.fileId}:${t.versionId}:${t.locale}`;
45
- return !existingTranslationsMap.has(key);
46
- });
47
- return {
48
- source: f.source,
49
- translations: newTranslations,
50
- };
51
- })
52
- .filter((f) => f.translations.length > 0);
53
- const skippedCount = totalTranslations -
54
- filesToUpload.reduce((acc, f) => acc + f.translations.length, 0);
55
- if (filesToUpload.length === 0) {
56
- this.spinner.stop(chalk.green(`All ${totalTranslations} translation files already uploaded`));
57
- return [];
58
- }
59
- const uploadCount = filesToUpload.reduce((acc, f) => acc + f.translations.length, 0);
60
- const response = await this.gt.uploadTranslations(filesToUpload, {
61
- sourceLocale: this.settings.defaultLocale,
62
- modelProvider: this.settings.modelProvider,
63
- });
64
- this.result = response.uploadedFiles;
65
- this.spinner.stop(chalk.green(`Translation files synced successfully! Uploaded: (${uploadCount}), Skipped: (${skippedCount})`));
66
- return this.result;
67
- }
68
- async wait() {
69
- return;
70
- }
71
- }
@@ -1,11 +0,0 @@
1
- import type { FileReference } from 'generaltranslation/types';
2
- import { WorkflowStep } from './WorkflowStep.js';
3
- import { Settings } from '../../types/index.js';
4
- export declare class UserEditDiffsStep extends WorkflowStep<FileReference[], FileReference[]> {
5
- private settings;
6
- private spinner;
7
- private completed;
8
- constructor(settings: Settings);
9
- run(files: FileReference[]): Promise<FileReference[]>;
10
- wait(): Promise<void>;
11
- }
@@ -1,30 +0,0 @@
1
- import { WorkflowStep } from './WorkflowStep.js';
2
- import { logger } from '../../console/logger.js';
3
- import chalk from 'chalk';
4
- import { collectAndSendUserEditDiffs } from '../../api/collectUserEditDiffs.js';
5
- export class UserEditDiffsStep extends WorkflowStep {
6
- settings;
7
- spinner = logger.createSpinner('dots');
8
- completed = false;
9
- constructor(settings) {
10
- super();
11
- this.settings = settings;
12
- }
13
- async run(files) {
14
- this.spinner.start('Updating translations...');
15
- try {
16
- await collectAndSendUserEditDiffs(files, this.settings);
17
- this.completed = true;
18
- }
19
- catch {
20
- // Non-fatal; keep going to enqueue
21
- this.completed = true;
22
- }
23
- return files;
24
- }
25
- async wait() {
26
- if (this.completed) {
27
- this.spinner.stop(chalk.green('Updated translations'));
28
- }
29
- }
30
- }
@@ -1,4 +0,0 @@
1
- export declare abstract class WorkflowStep<TInput = void, TOutput = void> {
2
- abstract run(input: TInput): Promise<TOutput>;
3
- abstract wait(): Promise<void>;
4
- }