gtx-cli 2.5.7 → 2.5.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 +15 -0
- package/dist/api/downloadFileBatch.js +5 -5
- package/dist/api/saveLocalEdits.js +4 -3
- package/dist/api/uploadFiles.d.ts +1 -1
- package/dist/api/uploadFiles.js +5 -4
- package/dist/cli/base.d.ts +2 -1
- package/dist/cli/base.js +36 -30
- package/dist/cli/commands/setupProject.d.ts +7 -0
- package/dist/cli/commands/setupProject.js +50 -0
- package/dist/cli/commands/stage.d.ts +0 -2
- package/dist/cli/commands/stage.js +13 -61
- package/dist/cli/commands/translate.js +3 -5
- package/dist/cli/flags.js +2 -3
- package/dist/cli/next.js +1 -0
- package/dist/cli/react.d.ts +1 -0
- package/dist/cli/react.js +26 -15
- package/dist/config/generateSettings.js +2 -2
- package/dist/config/validateSettings.d.ts +1 -1
- package/dist/config/validateSettings.js +4 -4
- package/dist/console/logger.d.ts +35 -0
- package/dist/console/logger.js +270 -0
- package/dist/console/logging.d.ts +6 -11
- package/dist/console/logging.js +40 -55
- package/dist/formats/files/collectFiles.d.ts +6 -0
- package/dist/formats/files/collectFiles.js +49 -0
- package/dist/formats/files/fileMapping.js +1 -1
- package/dist/formats/files/save.js +2 -2
- package/dist/formats/files/translate.js +8 -8
- package/dist/formats/files/upload.js +7 -6
- package/dist/formats/gt/save.js +4 -3
- package/dist/formats/json/flattenJson.js +3 -3
- package/dist/formats/json/mergeJson.js +19 -18
- package/dist/formats/json/parseJson.js +14 -13
- package/dist/formats/json/utils.js +16 -15
- package/dist/formats/yaml/mergeYaml.js +6 -5
- package/dist/formats/yaml/parseYaml.js +4 -3
- package/dist/formats/yaml/utils.js +4 -3
- package/dist/fs/clearLocaleDirs.js +6 -6
- package/dist/fs/config/downloadedVersions.js +3 -3
- package/dist/fs/config/parseFilesConfig.js +2 -2
- package/dist/fs/config/setupConfig.js +2 -2
- package/dist/fs/config/updateConfig.js +2 -2
- package/dist/fs/config/updateVersions.js +3 -3
- package/dist/fs/copyFile.js +2 -2
- package/dist/fs/createLoadTranslationsFile.d.ts +1 -1
- package/dist/fs/createLoadTranslationsFile.js +11 -4
- package/dist/fs/determineFramework.js +3 -3
- package/dist/fs/findFilepath.js +5 -4
- package/dist/hooks/postProcess.js +9 -9
- package/dist/next/parse/handleInitGT.js +2 -2
- package/dist/react/parse/addVitePlugin/index.js +4 -3
- package/dist/react/parse/addVitePlugin/installCompiler.js +2 -2
- package/dist/react/parse/addVitePlugin/updateViteConfig.js +9 -12
- package/dist/react/parse/createDictionaryUpdates.js +4 -3
- package/dist/react/parse/createInlineUpdates.js +2 -2
- package/dist/setup/wizard.js +17 -16
- package/dist/translation/parse.js +4 -3
- package/dist/translation/stage.js +4 -4
- package/dist/translation/validate.js +6 -6
- package/dist/types/index.d.ts +1 -0
- package/dist/utils/addExplicitAnchorIds.js +2 -2
- package/dist/utils/constants.d.ts +2 -0
- package/dist/utils/constants.js +3 -0
- package/dist/utils/credentials.js +4 -3
- package/dist/utils/installPackage.js +11 -11
- package/dist/utils/packageJson.js +4 -3
- package/dist/workflow/BranchStep.js +5 -4
- package/dist/workflow/DownloadStep.js +5 -5
- package/dist/workflow/EnqueueStep.js +2 -2
- package/dist/workflow/PollJobsStep.js +4 -4
- package/dist/workflow/SetupStep.d.ts +1 -1
- package/dist/workflow/SetupStep.js +4 -3
- package/dist/workflow/UploadStep.js +3 -3
- package/dist/workflow/UserEditDiffsStep.js +2 -2
- package/dist/workflow/download.js +4 -3
- package/dist/workflow/setupProject.d.ts +13 -0
- package/dist/workflow/setupProject.js +48 -0
- package/dist/workflow/stage.js +4 -21
- package/package.json +3 -3
- package/dist/utils/SpinnerManager.d.ts +0 -30
- package/dist/utils/SpinnerManager.js +0 -73
package/dist/workflow/stage.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { logErrorAndExit, logMessage } from '../console/logging.js';
|
|
1
|
+
import { logCollectedFiles, logErrorAndExit } from '../console/logging.js';
|
|
3
2
|
import { gt } from '../utils/gt.js';
|
|
4
|
-
import { TEMPLATE_FILE_NAME } from '../cli/commands/stage.js';
|
|
5
3
|
import { UploadStep } from './UploadStep.js';
|
|
6
4
|
import { SetupStep } from './SetupStep.js';
|
|
7
5
|
import { EnqueueStep } from './EnqueueStep.js';
|
|
@@ -14,21 +12,6 @@ function calculateTimeout(timeout) {
|
|
|
14
12
|
const value = timeout !== undefined ? Number(timeout) : 600;
|
|
15
13
|
return (Number.isFinite(value) ? value : 600) * 1000;
|
|
16
14
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Helper: Log files to be translated
|
|
19
|
-
*/
|
|
20
|
-
function logFilesToTranslate(files) {
|
|
21
|
-
logMessage(chalk.cyan('Files found in project:') +
|
|
22
|
-
'\n' +
|
|
23
|
-
files
|
|
24
|
-
.map((file) => {
|
|
25
|
-
if (file.fileName === TEMPLATE_FILE_NAME) {
|
|
26
|
-
return `- <React Elements>`;
|
|
27
|
-
}
|
|
28
|
-
return `- ${file.fileName}`;
|
|
29
|
-
})
|
|
30
|
-
.join('\n'));
|
|
31
|
-
}
|
|
32
15
|
/**
|
|
33
16
|
* Sends multiple files for translation to the API using a workflow pattern
|
|
34
17
|
* @param files - Array of file objects to translate
|
|
@@ -39,7 +22,7 @@ function logFilesToTranslate(files) {
|
|
|
39
22
|
export async function stageFiles(files, options, settings) {
|
|
40
23
|
try {
|
|
41
24
|
// Log files to be translated
|
|
42
|
-
|
|
25
|
+
logCollectedFiles(files);
|
|
43
26
|
// Calculate timeout for setup step
|
|
44
27
|
const timeoutMs = calculateTimeout(options.timeout);
|
|
45
28
|
// Create workflow with steps
|
|
@@ -52,7 +35,7 @@ export async function stageFiles(files, options, settings) {
|
|
|
52
35
|
const branchData = await branchStep.run();
|
|
53
36
|
await branchStep.wait();
|
|
54
37
|
if (!branchData) {
|
|
55
|
-
logErrorAndExit('Failed to resolve git branch information.');
|
|
38
|
+
return logErrorAndExit('Failed to resolve git branch information.');
|
|
56
39
|
}
|
|
57
40
|
// then run the upload step
|
|
58
41
|
const uploadedFiles = await uploadStep.run({ files, branchData });
|
|
@@ -71,6 +54,6 @@ export async function stageFiles(files, options, settings) {
|
|
|
71
54
|
return { branchData, enqueueResult };
|
|
72
55
|
}
|
|
73
56
|
catch (error) {
|
|
74
|
-
logErrorAndExit('Failed to send files for translation. ' + error);
|
|
57
|
+
return logErrorAndExit('Failed to send files for translation. ' + error);
|
|
75
58
|
}
|
|
76
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"files": [
|
|
@@ -76,7 +76,6 @@
|
|
|
76
76
|
"esbuild": "^0.25.4",
|
|
77
77
|
"fast-glob": "^3.3.3",
|
|
78
78
|
"fast-json-stable-stringify": "^2.1.0",
|
|
79
|
-
"form-data": "^4.0.4",
|
|
80
79
|
"gt-remark": "^1.0.1",
|
|
81
80
|
"json-pointer": "^0.6.2",
|
|
82
81
|
"jsonpath-plus": "^10.3.0",
|
|
@@ -84,6 +83,7 @@
|
|
|
84
83
|
"mdast-util-find-and-replace": "^3.0.2",
|
|
85
84
|
"micromatch": "^4.0.8",
|
|
86
85
|
"open": "^10.1.1",
|
|
86
|
+
"pino": "^10.1.0",
|
|
87
87
|
"remark-frontmatter": "^5.0.0",
|
|
88
88
|
"remark-mdx": "^3.1.0",
|
|
89
89
|
"remark-parse": "^11.0.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"unified": "^11.0.5",
|
|
94
94
|
"unist-util-visit": "^5.0.0",
|
|
95
95
|
"yaml": "^2.8.0",
|
|
96
|
-
"generaltranslation": "8.0.
|
|
96
|
+
"generaltranslation": "8.0.3"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@babel/types": "^7.28.4",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized spinner management for tracking multiple async operations
|
|
3
|
-
*/
|
|
4
|
-
export declare class SpinnerManager {
|
|
5
|
-
private spinners;
|
|
6
|
-
/**
|
|
7
|
-
* Run an async operation with a spinner
|
|
8
|
-
*/
|
|
9
|
-
run<T>(id: string, message: string, fn: () => Promise<T>): Promise<T>;
|
|
10
|
-
/**
|
|
11
|
-
* Mark a spinner as successful
|
|
12
|
-
*/
|
|
13
|
-
succeed(id: string, message: string): void;
|
|
14
|
-
/**
|
|
15
|
-
* Mark a spinner as warning
|
|
16
|
-
*/
|
|
17
|
-
warn(id: string, message: string): void;
|
|
18
|
-
/**
|
|
19
|
-
* Start a new spinner
|
|
20
|
-
*/
|
|
21
|
-
start(id: string, message: string): void;
|
|
22
|
-
/**
|
|
23
|
-
* Stop a specific spinner
|
|
24
|
-
*/
|
|
25
|
-
stop(id: string, message?: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Stop all running spinners
|
|
28
|
-
*/
|
|
29
|
-
stopAll(): void;
|
|
30
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { createSpinner } from '../console/logging.js';
|
|
3
|
-
/**
|
|
4
|
-
* Centralized spinner management for tracking multiple async operations
|
|
5
|
-
*/
|
|
6
|
-
export class SpinnerManager {
|
|
7
|
-
spinners = new Map();
|
|
8
|
-
/**
|
|
9
|
-
* Run an async operation with a spinner
|
|
10
|
-
*/
|
|
11
|
-
async run(id, message, fn) {
|
|
12
|
-
const spinner = createSpinner('dots');
|
|
13
|
-
this.spinners.set(id, spinner);
|
|
14
|
-
spinner.start(message);
|
|
15
|
-
try {
|
|
16
|
-
const result = await fn();
|
|
17
|
-
spinner.stop(chalk.green('✓'));
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
spinner.stop(chalk.red('✗'));
|
|
22
|
-
throw error;
|
|
23
|
-
}
|
|
24
|
-
finally {
|
|
25
|
-
this.spinners.delete(id);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Mark a spinner as successful
|
|
30
|
-
*/
|
|
31
|
-
succeed(id, message) {
|
|
32
|
-
const spinner = this.spinners.get(id);
|
|
33
|
-
if (spinner) {
|
|
34
|
-
spinner.stop(chalk.green(message));
|
|
35
|
-
this.spinners.delete(id);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Mark a spinner as warning
|
|
40
|
-
*/
|
|
41
|
-
warn(id, message) {
|
|
42
|
-
const spinner = this.spinners.get(id);
|
|
43
|
-
if (spinner) {
|
|
44
|
-
spinner.stop(chalk.yellow(message));
|
|
45
|
-
this.spinners.delete(id);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Start a new spinner
|
|
50
|
-
*/
|
|
51
|
-
start(id, message) {
|
|
52
|
-
const spinner = createSpinner('dots');
|
|
53
|
-
this.spinners.set(id, spinner);
|
|
54
|
-
spinner.start(message);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Stop a specific spinner
|
|
58
|
-
*/
|
|
59
|
-
stop(id, message) {
|
|
60
|
-
const spinner = this.spinners.get(id);
|
|
61
|
-
if (spinner) {
|
|
62
|
-
spinner.stop(message);
|
|
63
|
-
this.spinners.delete(id);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Stop all running spinners
|
|
68
|
-
*/
|
|
69
|
-
stopAll() {
|
|
70
|
-
this.spinners.forEach((s) => s.stop());
|
|
71
|
-
this.spinners.clear();
|
|
72
|
-
}
|
|
73
|
-
}
|