gtx-cli 1.2.0-alpha.4 → 1.2.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.
@@ -31,14 +31,15 @@ const downloadFileBatch_1 = require("./downloadFileBatch");
31
31
  function checkFileTranslations(apiKey, baseUrl, data, locales, timeoutDuration, resolveOutputPath, downloadStatus) {
32
32
  return __awaiter(this, void 0, void 0, function* () {
33
33
  const startTime = Date.now();
34
- const spinner = (0, console_1.createSpinner)();
34
+ console.log();
35
+ const spinner = (0, console_1.createOraSpinner)();
35
36
  spinner.start('Waiting for translation...');
36
37
  // Initialize the query data
37
38
  const fileQueryData = prepareFileQueryData(data, locales);
38
39
  // Do first check immediately
39
40
  const initialCheck = yield checkTranslationDeployment(baseUrl, apiKey, fileQueryData, downloadStatus, spinner, resolveOutputPath);
40
41
  if (initialCheck) {
41
- spinner.stop(chalk_1.default.green('Files translated!'));
42
+ spinner.succeed(chalk_1.default.green('Files translated!'));
42
43
  return true;
43
44
  }
44
45
  // Calculate time until next 5-second interval since startTime
@@ -53,11 +54,11 @@ function checkFileTranslations(apiKey, baseUrl, data, locales, timeoutDuration,
53
54
  if (isDeployed || elapsed >= timeoutDuration * 1000) {
54
55
  clearInterval(intervalCheck);
55
56
  if (isDeployed) {
56
- spinner.stop(chalk_1.default.green('All translations are live!'));
57
+ spinner.succeed(chalk_1.default.green('All files translated!'));
57
58
  resolve(true);
58
59
  }
59
60
  else {
60
- spinner.stop(chalk_1.default.red('Timed out waiting for translations'));
61
+ spinner.fail(chalk_1.default.red('Timed out waiting for translations'));
61
62
  resolve(false);
62
63
  }
63
64
  }
@@ -238,7 +239,7 @@ function checkTranslationDeployment(baseUrl, apiKey, fileQueryData, downloadStat
238
239
  // Force a refresh of the spinner display
239
240
  const statusText = generateStatusSuffixText(downloadStatus, fileQueryData);
240
241
  // Clear and reapply the suffix to force a refresh
241
- spinner.message(statusText);
242
+ spinner.text = statusText;
242
243
  }
243
244
  if (downloadStatus.downloaded.size + downloadStatus.failed.size ===
244
245
  fileQueryData.length) {
@@ -27,7 +27,7 @@ function sendFiles(files, options) {
27
27
  (0, console_1.logMessage)(chalk_1.default.cyan('Files to translate:') +
28
28
  '\n' +
29
29
  files.map((file) => ` - ${chalk_1.default.bold(file.fileName)}`).join('\n'));
30
- const spinner = (0, console_1.createSpinner)();
30
+ const spinner = (0, console_1.createSpinner)('dots');
31
31
  spinner.start(`Sending ${files.length} file${files.length > 1 ? 's' : ''} to General Translation API...`);
32
32
  try {
33
33
  // Create form data
@@ -31,7 +31,7 @@ function sendUpdates(updates, options, library) {
31
31
  // If not, then options.locales will be translated
32
32
  // If neither, then project.current_locales will be translated
33
33
  const body = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updates }, (options.locales && { locales: options.locales })), { metadata: globalMetadata, publish: options.publish }), (dataFormat && { dataFormat })), (options.versionId && { versionId: options.versionId })), (options.description && { description: options.description }));
34
- const spinner = (0, console_1.createSpinner)();
34
+ const spinner = (0, console_1.createSpinner)('dots');
35
35
  spinner.start(`Sending ${library} updates to General Translation API...`);
36
36
  try {
37
37
  const startTime = Date.now();
@@ -27,7 +27,8 @@ const generaltranslation_1 = require("generaltranslation");
27
27
  * @returns True if all translations are deployed, false otherwise
28
28
  */
29
29
  const waitForUpdates = (apiKey, baseUrl, versionId, locales, startTime, timeoutDuration) => __awaiter(void 0, void 0, void 0, function* () {
30
- const spinner = (0, console_1.createSpinner)();
30
+ console.log();
31
+ const spinner = (0, console_1.createOraSpinner)();
31
32
  spinner.start('Waiting for translation...');
32
33
  const availableLocales = [];
33
34
  const checkDeployment = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -46,7 +47,7 @@ const waitForUpdates = (apiKey, baseUrl, versionId, locales, startTime, timeoutD
46
47
  }
47
48
  });
48
49
  const newSuffixText = [
49
- chalk_1.default.green(`${availableLocales.length}/${locales.length}`) +
50
+ chalk_1.default.green(`[${availableLocales.length}/${locales.length}]`) +
50
51
  ` translations completed`,
51
52
  ...availableLocales.map((locale) => {
52
53
  const localeProperties = (0, generaltranslation_1.getLocaleProperties)(locale);
@@ -54,7 +55,7 @@ const waitForUpdates = (apiKey, baseUrl, versionId, locales, startTime, timeoutD
54
55
  }),
55
56
  ];
56
57
  // The new clack spinner doesn't have suffixText, just update the message
57
- spinner.message(newSuffixText.join('\n'));
58
+ spinner.text = newSuffixText.join('\n');
58
59
  }
59
60
  if (locales.every((locale) => availableLocales.includes(locale))) {
60
61
  return true;
@@ -71,7 +72,7 @@ const waitForUpdates = (apiKey, baseUrl, versionId, locales, startTime, timeoutD
71
72
  // Do first check immediately
72
73
  const initialCheck = yield checkDeployment();
73
74
  if (initialCheck) {
74
- spinner.stop(chalk_1.default.green('All translations are live!'));
75
+ spinner.succeed(chalk_1.default.green('All translations are live!'));
75
76
  return true;
76
77
  }
77
78
  return new Promise((resolve) => {
@@ -84,11 +85,11 @@ const waitForUpdates = (apiKey, baseUrl, versionId, locales, startTime, timeoutD
84
85
  if (isDeployed || elapsed >= timeoutDuration) {
85
86
  clearInterval(intervalCheck);
86
87
  if (isDeployed) {
87
- spinner.stop(chalk_1.default.green('All translations are live!'));
88
+ spinner.succeed(chalk_1.default.green('All translations are live!'));
88
89
  resolve(true);
89
90
  }
90
91
  else {
91
- spinner.stop(chalk_1.default.red('Timed out waiting for translations'));
92
+ spinner.fail(chalk_1.default.red('Timed out waiting for translations'));
92
93
  resolve(false);
93
94
  }
94
95
  }
@@ -17,6 +17,7 @@ export declare function createSpinner(indicator?: 'dots' | 'timer'): {
17
17
  stop: (msg?: string, code?: number) => void;
18
18
  message: (msg?: string) => void;
19
19
  };
20
+ export declare function createOraSpinner(indicator?: 'dots' | 'circleHalves'): import("ora").Ora;
20
21
  export declare function promptText({ message, defaultValue, validate, }: {
21
22
  message: string;
22
23
  defaultValue?: string;
@@ -27,6 +27,7 @@ exports.displayResolvedPaths = displayResolvedPaths;
27
27
  exports.displayCreatedConfigFile = displayCreatedConfigFile;
28
28
  exports.displayUpdatedConfigFile = displayUpdatedConfigFile;
29
29
  exports.createSpinner = createSpinner;
30
+ exports.createOraSpinner = createOraSpinner;
30
31
  exports.promptText = promptText;
31
32
  exports.promptSelect = promptSelect;
32
33
  exports.promptMultiSelect = promptMultiSelect;
@@ -40,6 +41,7 @@ exports.warnTemplateLiteral = warnTemplateLiteral;
40
41
  exports.warnTernary = warnTernary;
41
42
  const prompts_1 = require("@clack/prompts");
42
43
  const chalk_1 = __importDefault(require("chalk"));
44
+ const ora_1 = __importDefault(require("ora"));
43
45
  // Basic logging functions
44
46
  function logInfo(message) {
45
47
  prompts_1.log.info(message);
@@ -110,6 +112,10 @@ function displayUpdatedConfigFile(configFilepath) {
110
112
  function createSpinner(indicator = 'timer') {
111
113
  return (0, prompts_1.spinner)({ indicator });
112
114
  }
115
+ // Spinner functionality
116
+ function createOraSpinner(indicator = 'circleHalves') {
117
+ return (0, ora_1.default)({ spinner: indicator });
118
+ }
113
119
  // Input prompts
114
120
  function promptText(_a) {
115
121
  return __awaiter(this, arguments, void 0, function* ({ message, defaultValue, validate, }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "1.2.0-alpha.4",
3
+ "version": "1.2.0",
4
4
  "type": "commonjs",
5
5
  "main": "dist/index.js",
6
6
  "bin": "dist/main.js",