gtx-cli 1.2.25-alpha.0 → 1.2.25-alpha.10
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.
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.checkFileTranslations = checkFileTranslations;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const console_1 = require("../console");
|
|
9
|
-
const generaltranslation_1 =
|
|
9
|
+
const generaltranslation_1 = require("generaltranslation");
|
|
10
10
|
const downloadFile_1 = require("./downloadFile");
|
|
11
11
|
const downloadFileBatch_1 = require("./downloadFileBatch");
|
|
12
12
|
/**
|
|
@@ -132,21 +132,21 @@ function generateStatusSuffixText(downloadStatus, fileQueryData) {
|
|
|
132
132
|
// Add completed locales
|
|
133
133
|
if (status.completed.size > 0) {
|
|
134
134
|
const completedCodes = Array.from(status.completed)
|
|
135
|
-
.map((locale) => generaltranslation_1.
|
|
135
|
+
.map((locale) => generaltranslation_1.GT.getLocaleProperties(locale).code)
|
|
136
136
|
.join(', ');
|
|
137
137
|
localeStatuses.push(chalk_1.default.green(`${completedCodes}`));
|
|
138
138
|
}
|
|
139
139
|
// Add failed locales
|
|
140
140
|
if (status.failed.size > 0) {
|
|
141
141
|
const failedCodes = Array.from(status.failed)
|
|
142
|
-
.map((locale) => generaltranslation_1.
|
|
142
|
+
.map((locale) => generaltranslation_1.GT.getLocaleProperties(locale).code)
|
|
143
143
|
.join(', ');
|
|
144
144
|
localeStatuses.push(chalk_1.default.red(`${failedCodes}`));
|
|
145
145
|
}
|
|
146
146
|
// Add pending locales
|
|
147
147
|
if (status.pending.size > 0) {
|
|
148
148
|
const pendingCodes = Array.from(status.pending)
|
|
149
|
-
.map((locale) => generaltranslation_1.
|
|
149
|
+
.map((locale) => generaltranslation_1.GT.getLocaleProperties(locale).code)
|
|
150
150
|
.join(', ');
|
|
151
151
|
localeStatuses.push(chalk_1.default.yellow(`${pendingCodes}`));
|
|
152
152
|
}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.waitForUpdates = void 0;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const console_1 = require("../console");
|
|
9
|
-
const generaltranslation_1 =
|
|
9
|
+
const generaltranslation_1 = require("generaltranslation");
|
|
10
10
|
/**
|
|
11
11
|
* Waits for translations to be deployed to the General Translation API
|
|
12
12
|
* @param apiKey - The API key for the General Translation API
|
|
@@ -47,7 +47,7 @@ const waitForUpdates = async (apiKey, baseUrl, versionId, startTime, timeoutDura
|
|
|
47
47
|
chalk_1.default.green(`[${availableLocales.length}/${locales.length}]`) +
|
|
48
48
|
` translations completed`,
|
|
49
49
|
...availableLocales.map((locale) => {
|
|
50
|
-
const localeProperties = generaltranslation_1.
|
|
50
|
+
const localeProperties = generaltranslation_1.GT.getLocaleProperties(locale);
|
|
51
51
|
return `Translation completed for ${chalk_1.default.green(localeProperties.name)} (${chalk_1.default.green(localeProperties.code)})`;
|
|
52
52
|
}),
|
|
53
53
|
];
|
|
@@ -1,26 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.validateSettings = validateSettings;
|
|
7
|
-
const generaltranslation_1 =
|
|
4
|
+
const generaltranslation_1 = require("generaltranslation");
|
|
8
5
|
const console_1 = require("../console");
|
|
9
6
|
function validateSettings(settings) {
|
|
10
7
|
// Validate locales
|
|
11
8
|
for (const locale of settings.locales) {
|
|
12
|
-
if (!generaltranslation_1.
|
|
9
|
+
if (!generaltranslation_1.GT.isValidLocale(locale)) {
|
|
13
10
|
(0, console_1.logErrorAndExit)(`Provided locales: "${settings?.locales?.join()}", ${locale} is not a valid locale!`);
|
|
14
11
|
}
|
|
15
12
|
}
|
|
16
|
-
if (settings.defaultLocale && !generaltranslation_1.
|
|
13
|
+
if (settings.defaultLocale && !generaltranslation_1.GT.isValidLocale(settings.defaultLocale)) {
|
|
17
14
|
(0, console_1.logErrorAndExit)(`defaultLocale: ${settings.defaultLocale} is not a valid locale!`);
|
|
18
15
|
}
|
|
19
16
|
// defaultLocale cannot be a superset of any other locale
|
|
20
17
|
if (settings.defaultLocale &&
|
|
21
|
-
settings.locales.some((locale) => generaltranslation_1.
|
|
22
|
-
!generaltranslation_1.
|
|
23
|
-
const locale = settings.locales.find((locale) => generaltranslation_1.
|
|
18
|
+
settings.locales.some((locale) => generaltranslation_1.GT.isSupersetLocale(settings.defaultLocale, locale) &&
|
|
19
|
+
!generaltranslation_1.GT.isSupersetLocale(locale, settings.defaultLocale))) {
|
|
20
|
+
const locale = settings.locales.find((locale) => generaltranslation_1.GT.isSupersetLocale(settings.defaultLocale, locale));
|
|
24
21
|
(0, console_1.logErrorAndExit)(`defaultLocale: ${settings.defaultLocale} is a superset of another locale (${locale})! Please change the defaultLocale to a more specific locale.`);
|
|
25
22
|
}
|
|
26
23
|
}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.parseNextConfig = parseNextConfig;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const generaltranslation_1 =
|
|
8
|
+
const generaltranslation_1 = require("generaltranslation");
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
/**
|
|
11
11
|
* Extracts projectId, defaultLocale, and locales from a next.config.js file.
|
|
@@ -42,7 +42,7 @@ async function parseNextConfig(filePath) {
|
|
|
42
42
|
.filter((locale) => typeof locale === 'string')
|
|
43
43
|
: undefined;
|
|
44
44
|
// Ensure approvedLocales is an array of strings
|
|
45
|
-
const validLocales = locales && locales.every((locale) => generaltranslation_1.
|
|
45
|
+
const validLocales = locales && locales.every((locale) => generaltranslation_1.GT.isValidLocale(locale))
|
|
46
46
|
? locales
|
|
47
47
|
: undefined;
|
|
48
48
|
// Return the extracted values if they pass type checks or return null
|
package/dist/setup/userInput.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.getDesiredLocales = getDesiredLocales;
|
|
|
7
7
|
const internal_1 = require("generaltranslation/internal");
|
|
8
8
|
const console_1 = require("../console");
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
-
const generaltranslation_1 =
|
|
10
|
+
const generaltranslation_1 = require("generaltranslation");
|
|
11
11
|
async function getDesiredLocales() {
|
|
12
12
|
// Ask for the default locale
|
|
13
13
|
const defaultLocale = await (0, console_1.promptText)({
|
|
@@ -24,7 +24,7 @@ async function getDesiredLocales() {
|
|
|
24
24
|
return 'Please enter at least one locale';
|
|
25
25
|
}
|
|
26
26
|
for (const locale of localeList) {
|
|
27
|
-
if (!generaltranslation_1.
|
|
27
|
+
if (!generaltranslation_1.GT.isValidLocale(locale)) {
|
|
28
28
|
return 'Please enter a valid locale (e.g., en, fr, es)';
|
|
29
29
|
}
|
|
30
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "1.2.25-alpha.
|
|
3
|
+
"version": "1.2.25-alpha.10",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"files": [
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"esbuild": "^0.25.4",
|
|
80
80
|
"fast-glob": "^3.3.3",
|
|
81
81
|
"form-data": "^4.0.2",
|
|
82
|
-
"generaltranslation": "^7.0.0-alpha.
|
|
82
|
+
"generaltranslation": "^7.0.0-alpha.10",
|
|
83
83
|
"open": "^10.1.1",
|
|
84
84
|
"ora": "^8.2.0",
|
|
85
85
|
"resolve": "^1.22.10",
|