gtx-cli 1.0.2 → 1.0.3-alpha.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.
- package/dist/cli/base.js +2 -1
- package/dist/cli/react.js +9 -3
- package/dist/config/generateSettings.js +1 -1
- package/package.json +2 -2
package/dist/cli/base.js
CHANGED
|
@@ -60,6 +60,7 @@ const translate_1 = require("../formats/json/translate");
|
|
|
60
60
|
const utils_1 = require("../fs/utils");
|
|
61
61
|
const generateSettings_1 = require("../config/generateSettings");
|
|
62
62
|
const chalk_1 = __importDefault(require("chalk"));
|
|
63
|
+
const internal_1 = require("generaltranslation/internal");
|
|
63
64
|
const SUPPORTED_DATA_FORMATS = ['JSX', 'ICU', 'I18NEXT'];
|
|
64
65
|
class BaseCLI {
|
|
65
66
|
// Constructor is shared amongst all CLI class types
|
|
@@ -160,7 +161,7 @@ class BaseCLI {
|
|
|
160
161
|
// Ask for the default locale
|
|
161
162
|
const defaultLocale = yield (0, prompts_1.input)({
|
|
162
163
|
message: 'What is the default locale for your project?',
|
|
163
|
-
default:
|
|
164
|
+
default: internal_1.libraryDefaultLocale,
|
|
164
165
|
});
|
|
165
166
|
// Ask for the locales
|
|
166
167
|
const locales = yield (0, prompts_1.input)({
|
package/dist/cli/react.js
CHANGED
|
@@ -53,6 +53,7 @@ const loadJSON_1 = __importDefault(require("../fs/loadJSON"));
|
|
|
53
53
|
const findFilepath_1 = __importStar(require("../fs/findFilepath"));
|
|
54
54
|
const createESBuildConfig_1 = __importDefault(require("../react/config/createESBuildConfig"));
|
|
55
55
|
const errors_1 = require("../console/errors");
|
|
56
|
+
const internal_1 = require("generaltranslation/internal");
|
|
56
57
|
const chalk_1 = __importDefault(require("chalk"));
|
|
57
58
|
const prompts_1 = require("@inquirer/prompts");
|
|
58
59
|
const postProcess_1 = require("../hooks/postProcess");
|
|
@@ -122,7 +123,7 @@ class ReactCLI extends base_1.BaseCLI {
|
|
|
122
123
|
.option('--src <paths...>', "Filepath to directory containing the app's source code, by default ./src || ./app || ./pages || ./components", (0, findFilepath_1.findFilepaths)(['./src', './app', './pages', './components']))
|
|
123
124
|
.option('--tsconfig, --jsconfig <path>', 'Path to jsconfig or tsconfig file', (0, findFilepath_1.default)(['./tsconfig.json', './jsconfig.json']))
|
|
124
125
|
.option('--dictionary <path>', 'Path to dictionary file')
|
|
125
|
-
.option('--default-language, --default-locale <locale>', 'Source locale (e.g., en)',
|
|
126
|
+
.option('--default-language, --default-locale <locale>', 'Source locale (e.g., en)', internal_1.libraryDefaultLocale)
|
|
126
127
|
.option('--inline', 'Include inline <T> tags in addition to dictionary file', true)
|
|
127
128
|
.option('--ignore-errors', 'Ignore errors encountered while scanning for <T> tags', false)
|
|
128
129
|
.option('-t, --translations-dir, --translation-dir <path>', 'Path to directory where translations will be saved. If this flag is not provided, translations will not be saved locally.')
|
|
@@ -184,8 +185,13 @@ class ReactCLI extends base_1.BaseCLI {
|
|
|
184
185
|
const newData = {};
|
|
185
186
|
for (const update of updates) {
|
|
186
187
|
const { source, metadata } = update;
|
|
187
|
-
const { hash } = metadata;
|
|
188
|
-
|
|
188
|
+
const { hash, id } = metadata;
|
|
189
|
+
if (id) {
|
|
190
|
+
newData[id] = source;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
newData[hash] = source;
|
|
194
|
+
}
|
|
189
195
|
}
|
|
190
196
|
// Save source file if translationsDir exists
|
|
191
197
|
if (settings.translationsDir) {
|
|
@@ -39,7 +39,7 @@ function generateSettings(options) {
|
|
|
39
39
|
// Add baseUrl if not provided
|
|
40
40
|
mergedOptions.baseUrl = mergedOptions.baseUrl || internal_1.defaultBaseUrl;
|
|
41
41
|
// Add defaultLocale if not provided
|
|
42
|
-
mergedOptions.defaultLocale = mergedOptions.defaultLocale ||
|
|
42
|
+
mergedOptions.defaultLocale = mergedOptions.defaultLocale || internal_1.libraryDefaultLocale;
|
|
43
43
|
// Add locales if not provided
|
|
44
44
|
mergedOptions.locales = mergedOptions.locales || [];
|
|
45
45
|
// Add default config file name if not provided
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3-alpha.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"scripts": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"commander": "^12.1.0",
|
|
53
53
|
"dotenv": "^16.4.5",
|
|
54
54
|
"esbuild": "^0.23.1",
|
|
55
|
-
"generaltranslation": "^6.2.
|
|
55
|
+
"generaltranslation": "^6.2.2-alpha.0",
|
|
56
56
|
"ora": "^8.2.0",
|
|
57
57
|
"yaml": "^2.7.0"
|
|
58
58
|
},
|