gtx-cli 2.3.8 → 2.3.9-alpha.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.
@@ -1,5 +1,5 @@
1
1
  import chalk from 'chalk';
2
- import { createSpinner, logError, logMessage, logSuccess, } from '../console/logging.js';
2
+ import { createSpinner, logErrorAndExit, logMessage, logSuccess, } from '../console/logging.js';
3
3
  import { gt } from '../utils/gt.js';
4
4
  import { TEMPLATE_FILE_NAME } from '../cli/commands/stage.js';
5
5
  /**
@@ -29,7 +29,7 @@ export async function sendFiles(files, options, settings) {
29
29
  const sourceLocale = settings.defaultLocale;
30
30
  if (!sourceLocale) {
31
31
  uploadSpinner.stop(chalk.red('Missing default source locale'));
32
- throw new Error('sendFiles: settings.defaultLocale is required to upload source files');
32
+ logErrorAndExit('sendFiles: settings.defaultLocale is required to upload source files');
33
33
  }
34
34
  // Convert FileToTranslate[] -> { source: FileUpload }[]
35
35
  const uploads = files.map(({ content, fileName, fileFormat, dataFormat }) => ({
@@ -105,11 +105,10 @@ export async function sendFiles(files, options, settings) {
105
105
  logSuccess(message);
106
106
  return { data, locales, translations };
107
107
  }
108
- catch (error) {
108
+ catch {
109
109
  if (currentSpinner) {
110
- currentSpinner.stop(chalk.red('Failed to send files for translation'));
110
+ currentSpinner.stop();
111
111
  }
112
- logError('Failed to send files for translation');
113
- throw error;
112
+ logErrorAndExit('Failed to send files for translation');
114
113
  }
115
114
  }
package/dist/cli/flags.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import findFilepath from '../fs/findFilepath.js';
2
+ import { logErrorAndExit } from '../console/logging.js';
2
3
  const DEFAULT_TIMEOUT = 600;
3
4
  export function attachTranslateFlags(command) {
4
5
  command
@@ -12,10 +13,10 @@ export function attachTranslateFlags(command) {
12
13
  .option('--timeout <seconds>', 'Translation wait timeout in seconds', (value) => {
13
14
  const parsedValue = parseInt(value, 10);
14
15
  if (isNaN(parsedValue)) {
15
- throw new Error('Not a number.');
16
+ logErrorAndExit('Not a number.');
16
17
  }
17
18
  if (parsedValue < 0) {
18
- throw new Error('Timeout must be a positive number.');
19
+ logErrorAndExit('Timeout must be a positive number.');
19
20
  }
20
21
  return parsedValue;
21
22
  }, DEFAULT_TIMEOUT)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.3.8",
3
+ "version": "2.3.9-alpha.0",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "files": [