gtx-cli 1.1.13 → 1.1.15
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/react.js +1 -1
- package/dist/main.js +1 -0
- package/dist/react/jsx/utils/parseJsx.js +12 -2
- package/dist/react/jsx/wrapJsx.js +8 -4
- package/dist/types/index.d.ts +1 -0
- package/package.json +4 -4
package/dist/cli/react.js
CHANGED
|
@@ -316,7 +316,7 @@ class ReactCLI extends base_1.BaseCLI {
|
|
|
316
316
|
}
|
|
317
317
|
else if (frameworkType === 'other') {
|
|
318
318
|
console.log(chalk_1.default.red(`\nSorry, at the moment we currently do not support other React frameworks.
|
|
319
|
-
Please let us know what you would like to see supported at https://github.com/
|
|
319
|
+
Please let us know what you would like to see supported at https://github.com/generaltranslation/gt/issues`));
|
|
320
320
|
process.exit(0);
|
|
321
321
|
}
|
|
322
322
|
const selectedFramework = frameworkType === 'next' ? 'next-pages' : 'next-app';
|
package/dist/main.js
CHANGED
|
@@ -8,4 +8,5 @@ const index_1 = __importDefault(require("./index"));
|
|
|
8
8
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
9
|
dotenv_1.default.config({ path: '.env' });
|
|
10
10
|
dotenv_1.default.config({ path: '.env.local', override: true });
|
|
11
|
+
dotenv_1.default.config({ path: '.env.production', override: true });
|
|
11
12
|
(0, index_1.default)();
|
|
@@ -207,9 +207,19 @@ function parseJSXElement(importAliases, node, updates, errors, file) {
|
|
|
207
207
|
if (!staticAnalysis.isStatic) {
|
|
208
208
|
errors.push((0, warnings_1.warnVariableProp)(file, attrName, code));
|
|
209
209
|
}
|
|
210
|
+
// Use the static value if available
|
|
211
|
+
if (staticAnalysis.isStatic && staticAnalysis.value !== undefined) {
|
|
212
|
+
componentObj.props[attrName] = staticAnalysis.value;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
// Only store the code if we couldn't extract a static value
|
|
216
|
+
componentObj.props[attrName] = code;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
// For other attributes that aren't id or context
|
|
221
|
+
componentObj.props[attrName] = code;
|
|
210
222
|
}
|
|
211
|
-
// Store the value (for all props)
|
|
212
|
-
componentObj.props[attrName] = code;
|
|
213
223
|
}
|
|
214
224
|
}
|
|
215
225
|
});
|
|
@@ -111,7 +111,7 @@ function wrapJsxExpression(node, options, isMeaningful, mark) {
|
|
|
111
111
|
// Do nothing
|
|
112
112
|
}
|
|
113
113
|
else {
|
|
114
|
-
if ((0, evaluateJsx_1.isStaticValue)(consequent)) {
|
|
114
|
+
if ((0, evaluateJsx_1.isStaticValue)(consequent) && isMeaningful(consequent)) {
|
|
115
115
|
const wrapped = wrapExpressionWithT(consequent, options, false);
|
|
116
116
|
// Re-insert into parenthesized expression if necessary
|
|
117
117
|
if (t.isParenthesizedExpression(expression.consequent)) {
|
|
@@ -155,7 +155,7 @@ function wrapJsxExpression(node, options, isMeaningful, mark) {
|
|
|
155
155
|
// Do nothing
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
158
|
-
if ((0, evaluateJsx_1.isStaticValue)(alternate)) {
|
|
158
|
+
if ((0, evaluateJsx_1.isStaticValue)(alternate) && isMeaningful(alternate)) {
|
|
159
159
|
const wrapped = wrapExpressionWithT(alternate, options, false);
|
|
160
160
|
// Re-insert into parenthesized expression if necessary
|
|
161
161
|
if (t.isParenthesizedExpression(expression.alternate)) {
|
|
@@ -204,7 +204,9 @@ function wrapJsxExpression(node, options, isMeaningful, mark) {
|
|
|
204
204
|
// Do nothing - don't wrap them
|
|
205
205
|
}
|
|
206
206
|
else {
|
|
207
|
-
if ((0, evaluateJsx_1.isStaticValue)(left) &&
|
|
207
|
+
if ((0, evaluateJsx_1.isStaticValue)(left) &&
|
|
208
|
+
isMeaningful(left) &&
|
|
209
|
+
expression.operator !== '&&') {
|
|
208
210
|
const wrapped = wrapExpressionWithT(left, options, false);
|
|
209
211
|
// Re-insert into parenthesized expression if necessary
|
|
210
212
|
if (t.isParenthesizedExpression(expression.left)) {
|
|
@@ -245,7 +247,9 @@ function wrapJsxExpression(node, options, isMeaningful, mark) {
|
|
|
245
247
|
// Do nothing - don't wrap them
|
|
246
248
|
}
|
|
247
249
|
else {
|
|
248
|
-
if ((0, evaluateJsx_1.isStaticValue)(right)
|
|
250
|
+
if ((0, evaluateJsx_1.isStaticValue)(right) &&
|
|
251
|
+
isMeaningful(right) &&
|
|
252
|
+
expression.operator !== '||') {
|
|
249
253
|
const wrapped = wrapExpressionWithT(right, options, false);
|
|
250
254
|
// Re-insert into parenthesized expression if necessary
|
|
251
255
|
if (t.isParenthesizedExpression(expression.right)) {
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/
|
|
28
|
+
"url": "git+https://github.com/generaltranslation/gt.git"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"i18n",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"author": "",
|
|
39
39
|
"license": "FSL-1.1-ALv2",
|
|
40
40
|
"bugs": {
|
|
41
|
-
"url": "https://github.com/
|
|
41
|
+
"url": "https://github.com/generaltranslation/gt/issues"
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://generaltranslation.com/",
|
|
44
44
|
"description": "CLI tool for AI-powered i18n",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"esbuild": "^0.23.1",
|
|
55
55
|
"fast-glob": "^3.3.3",
|
|
56
56
|
"form-data": "^4.0.2",
|
|
57
|
-
"generaltranslation": "^6.2.
|
|
57
|
+
"generaltranslation": "^6.2.3",
|
|
58
58
|
"ora": "^8.2.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|