gtx-cli 1.1.4 → 1.1.6

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
- // Update the spinner text
76
- spinner.suffixText = generateStatusSuffixText(downloadedFiles, fileQueryData);
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
- const newSuffixText = [
97
- `\n\n` +
98
- chalk_1.default.green(`${downloadedFiles.size}/${fileQueryData.length}`) +
99
- ` translations completed\n`,
100
- ];
101
- // Group by filename for better organization
102
- const fileGroups = new Map();
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 (!fileGroups.has(item.fileName)) {
106
- fileGroups.set(item.fileName, new Set());
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 completedLocales = fileGroups.get(fileName);
114
- if (completedLocales) {
115
- completedLocales.delete(locale); // Remove from pending
125
+ const status = fileStatus.get(fileName);
126
+ if (status) {
127
+ status.pending.delete(locale);
128
+ status.completed.add(locale);
116
129
  }
117
130
  }
118
- // Display each file with its status
119
- for (const [fileName, pendingLocales] of fileGroups.entries()) {
120
- newSuffixText.push(`\n${chalk_1.default.bold(fileName)}`);
121
- // Show completed locales for this file
122
- for (const fileLocale of downloadedFiles) {
123
- const [currentFileName, locale] = fileLocale.split(':');
124
- if (currentFileName === fileName) {
125
- const localeProperties = (0, generaltranslation_1.getLocaleProperties)(locale);
126
- newSuffixText.push(` ${chalk_1.default.green('✓')} ${chalk_1.default.green(localeProperties.code)}`);
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
- // Show pending locales for this file
130
- for (const locale of pendingLocales) {
131
- const localeProperties = (0, generaltranslation_1.getLocaleProperties)(locale);
132
- newSuffixText.push(` ${chalk_1.default.yellow('[==>')} ${chalk_1.default.yellow(localeProperties.code)}`);
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
  }
@@ -13,8 +13,6 @@ function getVariableName(props = {}, variableType) {
13
13
  var _a;
14
14
  if (props.name)
15
15
  return props.name;
16
- if (props['data-_gt-variable-name'])
17
- return props['data-_gt-variable-name'];
18
16
  const baseVariableName = defaultVariableNames[variableType] || 'value';
19
17
  return `${exports.baseVariablePrefix}${baseVariableName}_${(_a = props['data-_gt']) === null || _a === void 0 ? void 0 : _a.id}`;
20
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "scripts": {