gtx-cli 2.3.8 → 2.3.9
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 +6 -0
- package/dist/api/sendFiles.js +5 -6
- package/dist/cli/flags.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.3.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#715](https://github.com/generaltranslation/gt/pull/715) [`cc6c06a`](https://github.com/generaltranslation/gt/commit/cc6c06abf0ad0f00f55825e85d59d199ffbec263) Thanks [@brian-lou](https://github.com/brian-lou)! - Instead of throwing errors, CLI will now call process.exit
|
|
8
|
+
|
|
3
9
|
## 2.3.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/api/sendFiles.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { createSpinner,
|
|
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
|
-
|
|
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
|
|
108
|
+
catch {
|
|
109
109
|
if (currentSpinner) {
|
|
110
|
-
currentSpinner.stop(
|
|
110
|
+
currentSpinner.stop();
|
|
111
111
|
}
|
|
112
|
-
|
|
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
|
-
|
|
16
|
+
logErrorAndExit('Not a number.');
|
|
16
17
|
}
|
|
17
18
|
if (parsedValue < 0) {
|
|
18
|
-
|
|
19
|
+
logErrorAndExit('Timeout must be a positive number.');
|
|
19
20
|
}
|
|
20
21
|
return parsedValue;
|
|
21
22
|
}, DEFAULT_TIMEOUT)
|