gtx-cli 2.3.3 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # gtx-cli
2
2
 
3
+ ## 2.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#671](https://github.com/generaltranslation/gt/pull/671) [`b8c19d1`](https://github.com/generaltranslation/gt/commit/b8c19d13c0ab18a3f9376ebb940d9985cee6d961) Thanks [@fernando-aviles](https://github.com/fernando-aviles)! - Fixing --force command in gtx-cli
8
+
3
9
  ## 2.3.3
4
10
 
5
11
  ### Patch Changes
@@ -20,4 +20,4 @@ export declare function checkFileTranslations(data: {
20
20
  versionId: string;
21
21
  fileName: string;
22
22
  };
23
- }, locales: string[], timeoutDuration: number, resolveOutputPath: (sourcePath: string, locale: string) => string | null, options: Settings): Promise<boolean>;
23
+ }, locales: string[], timeoutDuration: number, resolveOutputPath: (sourcePath: string, locale: string) => string | null, options: Settings, forceRetranslation?: boolean): Promise<boolean>;
@@ -14,11 +14,14 @@ import { TEMPLATE_FILE_NAME } from '../cli/commands/stage.js';
14
14
  * @param timeoutDuration - The timeout duration for the wait in seconds
15
15
  * @returns True if all translations are deployed, false otherwise
16
16
  */
17
- export async function checkFileTranslations(data, locales, timeoutDuration, resolveOutputPath, options) {
17
+ export async function checkFileTranslations(data, locales, timeoutDuration, resolveOutputPath, options, forceRetranslation) {
18
18
  const startTime = Date.now();
19
19
  console.log();
20
20
  const spinner = await createOraSpinner();
21
- spinner.start('Waiting for translation...');
21
+ const spinnerMessage = forceRetranslation
22
+ ? 'Waiting for retranslation...'
23
+ : 'Waiting for translation...';
24
+ spinner.start(spinnerMessage);
22
25
  // Initialize the query data
23
26
  const fileQueryData = prepareFileQueryData(data, locales);
24
27
  const downloadStatus = {
@@ -26,11 +29,13 @@ export async function checkFileTranslations(data, locales, timeoutDuration, reso
26
29
  failed: new Set(),
27
30
  skipped: new Set(),
28
31
  };
29
- // Do first check immediately
30
- const initialCheck = await checkTranslationDeployment(fileQueryData, downloadStatus, spinner, resolveOutputPath, options);
31
- if (initialCheck) {
32
- spinner.succeed(chalk.green('Files translated!'));
33
- return true;
32
+ // Do first check immediately, but skip if force retranslation is enabled
33
+ if (!forceRetranslation) {
34
+ const initialCheck = await checkTranslationDeployment(fileQueryData, downloadStatus, spinner, resolveOutputPath, options);
35
+ if (initialCheck) {
36
+ spinner.succeed(chalk.green('Files translated!'));
37
+ return true;
38
+ }
34
39
  }
35
40
  // Calculate time until next 5-second interval since startTime
36
41
  const msUntilNextInterval = Math.max(0, 5000 - ((Date.now() - startTime) % 5000));
@@ -15,7 +15,7 @@ export async function handleTranslate(options, settings, filesTranslationRespons
15
15
  const fileMapping = createFileMapping(resolvedPaths, placeholderPaths, transformPaths, settings.locales, settings.defaultLocale);
16
16
  const { data } = filesTranslationResponse;
17
17
  // Check for remaining translations
18
- await checkFileTranslations(data, settings.locales, options.timeout, (sourcePath, locale) => fileMapping[locale][sourcePath] ?? null, settings);
18
+ await checkFileTranslations(data, settings.locales, options.timeout, (sourcePath, locale) => fileMapping[locale][sourcePath] ?? null, settings, options.force);
19
19
  }
20
20
  }
21
21
  // Downloads translations that were originally staged
@@ -33,7 +33,8 @@ export async function handleDownload(options, settings) {
33
33
  const fileMapping = createFileMapping(resolvedPaths, placeholderPaths, transformPaths, settings.locales, settings.defaultLocale);
34
34
  const stagedVersionData = await getStagedVersions(settings.configDirectory);
35
35
  // Check for remaining translations
36
- await checkFileTranslations(stagedVersionData, settings.locales, options.timeout, (sourcePath, locale) => fileMapping[locale][sourcePath] ?? null, settings);
36
+ await checkFileTranslations(stagedVersionData, settings.locales, options.timeout, (sourcePath, locale) => fileMapping[locale][sourcePath] ?? null, settings, false // force is not applicable for downloading staged translations
37
+ );
37
38
  }
38
39
  export async function postProcessTranslations(settings) {
39
40
  // Localize static urls (/docs -> /[locale]/docs) and preserve anchor IDs for non-default locales
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [