gtx-cli 1.1.4 → 1.1.5
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.
|
@@ -72,8 +72,10 @@ function checkFileTranslations(apiKey, baseUrl, data, locales, timeoutDuration,
|
|
|
72
72
|
yield (0, downloadFile_1.downloadFile)(baseUrl, apiKey, translationId, outputPath);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
//
|
|
76
|
-
|
|
75
|
+
// Force a refresh of the spinner display
|
|
76
|
+
const statusText = generateStatusSuffixText(downloadedFiles, fileQueryData);
|
|
77
|
+
// Clear and reapply the suffix to force a refresh
|
|
78
|
+
spinner.suffixText = statusText;
|
|
77
79
|
}
|
|
78
80
|
if (downloadedFiles.size === fileQueryData.length) {
|
|
79
81
|
return true;
|
|
@@ -93,44 +95,69 @@ function checkFileTranslations(apiKey, baseUrl, data, locales, timeoutDuration,
|
|
|
93
95
|
*/
|
|
94
96
|
function generateStatusSuffixText(downloadedFiles, fileQueryData) {
|
|
95
97
|
var _a;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
|
|
98
|
+
// Simple progress indicator
|
|
99
|
+
const progressText = chalk_1.default.green(`[${downloadedFiles.size}/${fileQueryData.length}]`) +
|
|
100
|
+
` translations completed`;
|
|
101
|
+
// Get terminal height to adapt our output
|
|
102
|
+
const terminalHeight = process.stdout.rows || 24; // Default to 24 if undefined
|
|
103
|
+
// If terminal is very small, just show the basic progress
|
|
104
|
+
if (terminalHeight < 6) {
|
|
105
|
+
return `\n${progressText}`;
|
|
106
|
+
}
|
|
107
|
+
const newSuffixText = [`\n${progressText}`];
|
|
108
|
+
// Organize data by filename
|
|
109
|
+
const fileStatus = new Map();
|
|
103
110
|
// Initialize with all files and locales from fileQueryData
|
|
104
111
|
for (const item of fileQueryData) {
|
|
105
|
-
if (!
|
|
106
|
-
|
|
112
|
+
if (!fileStatus.has(item.fileName)) {
|
|
113
|
+
fileStatus.set(item.fileName, {
|
|
114
|
+
completed: new Set(),
|
|
115
|
+
pending: new Set([item.locale]),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
(_a = fileStatus.get(item.fileName)) === null || _a === void 0 ? void 0 : _a.pending.add(item.locale);
|
|
107
120
|
}
|
|
108
|
-
(_a = fileGroups.get(item.fileName)) === null || _a === void 0 ? void 0 : _a.add(item.locale);
|
|
109
121
|
}
|
|
110
122
|
// Mark which ones are completed
|
|
111
123
|
for (const fileLocale of downloadedFiles) {
|
|
112
124
|
const [fileName, locale] = fileLocale.split(':');
|
|
113
|
-
const
|
|
114
|
-
if (
|
|
115
|
-
|
|
125
|
+
const status = fileStatus.get(fileName);
|
|
126
|
+
if (status) {
|
|
127
|
+
status.pending.delete(locale);
|
|
128
|
+
status.completed.add(locale);
|
|
116
129
|
}
|
|
117
130
|
}
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
131
|
+
// Calculate how many files we can show based on terminal height
|
|
132
|
+
// Each file takes 1 line now
|
|
133
|
+
const filesArray = Array.from(fileStatus.entries());
|
|
134
|
+
const maxFilesToShow = Math.min(filesArray.length, terminalHeight - 3 // Header + progress + buffer
|
|
135
|
+
);
|
|
136
|
+
// Display each file with its status on a single line
|
|
137
|
+
for (let i = 0; i < maxFilesToShow; i++) {
|
|
138
|
+
const [fileName, status] = filesArray[i];
|
|
139
|
+
// Create condensed locale status
|
|
140
|
+
const localeStatuses = [];
|
|
141
|
+
// Add completed locales
|
|
142
|
+
if (status.completed.size > 0) {
|
|
143
|
+
const completedCodes = Array.from(status.completed)
|
|
144
|
+
.map((locale) => (0, generaltranslation_1.getLocaleProperties)(locale).code)
|
|
145
|
+
.join(', ');
|
|
146
|
+
localeStatuses.push(chalk_1.default.green(`${completedCodes}`));
|
|
128
147
|
}
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
148
|
+
// Add pending locales
|
|
149
|
+
if (status.pending.size > 0) {
|
|
150
|
+
const pendingCodes = Array.from(status.pending)
|
|
151
|
+
.map((locale) => (0, generaltranslation_1.getLocaleProperties)(locale).code)
|
|
152
|
+
.join(', ');
|
|
153
|
+
localeStatuses.push(chalk_1.default.yellow(`${pendingCodes}`));
|
|
133
154
|
}
|
|
155
|
+
// Format the line
|
|
156
|
+
newSuffixText.push(`${chalk_1.default.bold(fileName)} [${localeStatuses.join(', ')}]`);
|
|
157
|
+
}
|
|
158
|
+
// If we couldn't show all files, add an indicator
|
|
159
|
+
if (filesArray.length > maxFilesToShow) {
|
|
160
|
+
newSuffixText.push(`... and ${filesArray.length - maxFilesToShow} more files`);
|
|
134
161
|
}
|
|
135
162
|
return newSuffixText.join('\n');
|
|
136
163
|
}
|
|
@@ -11,10 +11,6 @@ const defaultVariableNames = {
|
|
|
11
11
|
exports.baseVariablePrefix = '_gt_';
|
|
12
12
|
function getVariableName(props = {}, variableType) {
|
|
13
13
|
var _a;
|
|
14
|
-
if (props.name)
|
|
15
|
-
return props.name;
|
|
16
|
-
if (props['data-_gt-variable-name'])
|
|
17
|
-
return props['data-_gt-variable-name'];
|
|
18
14
|
const baseVariableName = defaultVariableNames[variableType] || 'value';
|
|
19
15
|
return `${exports.baseVariablePrefix}${baseVariableName}_${(_a = props['data-_gt']) === null || _a === void 0 ? void 0 : _a.id}`;
|
|
20
16
|
}
|