gt 2.8.2 → 2.9.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/CHANGELOG.md +12 -0
- package/dist/cli/base.js +4 -0
- package/dist/cli/commands/upload.js +21 -1
- package/dist/formats/files/aggregateFiles.js +43 -1
- package/dist/formats/files/supportedFiles.d.ts +2 -1
- package/dist/formats/files/supportedFiles.js +2 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1099](https://github.com/generaltranslation/gt/pull/1099) [`e364093`](https://github.com/generaltranslation/gt/commit/e3640931cf0ca2df08dcadbae30b1668e14a3ed8) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add twilio json support for cli
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`e364093`](https://github.com/generaltranslation/gt/commit/e3640931cf0ca2df08dcadbae30b1668e14a3ed8)]:
|
|
12
|
+
- generaltranslation@8.1.16
|
|
13
|
+
- @generaltranslation/python-extractor@0.1.2
|
|
14
|
+
|
|
3
15
|
## 2.8.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cli/base.js
CHANGED
|
@@ -399,6 +399,10 @@ See https://generaltranslation.com/en/docs/next/guides/local-tx`);
|
|
|
399
399
|
{ value: 'ts', label: FILE_EXT_TO_EXT_LABEL.ts },
|
|
400
400
|
{ value: 'js', label: FILE_EXT_TO_EXT_LABEL.js },
|
|
401
401
|
{ value: 'yaml', label: FILE_EXT_TO_EXT_LABEL.yaml },
|
|
402
|
+
{
|
|
403
|
+
value: 'twilioContentJson',
|
|
404
|
+
label: FILE_EXT_TO_EXT_LABEL.twilioContentJson,
|
|
405
|
+
},
|
|
402
406
|
],
|
|
403
407
|
required: !isUsingGT,
|
|
404
408
|
});
|
|
@@ -74,8 +74,28 @@ export async function upload(filePaths, placeholderPaths, transformPaths, dataFo
|
|
|
74
74
|
});
|
|
75
75
|
allFiles.push(...yamlFiles);
|
|
76
76
|
}
|
|
77
|
+
// Process Twilio Content JSON files
|
|
78
|
+
if (filePaths.twilioContentJson) {
|
|
79
|
+
const twilioContentJsonFiles = filePaths.twilioContentJson.map((filePath) => {
|
|
80
|
+
const content = readFile(filePath);
|
|
81
|
+
const parsedJson = parseJson(content, filePath, additionalOptions, settings.defaultLocale);
|
|
82
|
+
const relativePath = getRelative(filePath);
|
|
83
|
+
return {
|
|
84
|
+
content: parsedJson,
|
|
85
|
+
fileName: relativePath,
|
|
86
|
+
fileFormat: 'TWILIO_CONTENT_JSON',
|
|
87
|
+
dataFormat: 'STRING',
|
|
88
|
+
locale: settings.defaultLocale,
|
|
89
|
+
fileId: hashStringSync(relativePath),
|
|
90
|
+
versionId: hashStringSync(parsedJson),
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
allFiles.push(...twilioContentJsonFiles);
|
|
94
|
+
}
|
|
77
95
|
for (const fileType of SUPPORTED_FILE_EXTENSIONS) {
|
|
78
|
-
if (fileType === 'json' ||
|
|
96
|
+
if (fileType === 'json' ||
|
|
97
|
+
fileType === 'yaml' ||
|
|
98
|
+
fileType === 'twilioContentJson')
|
|
79
99
|
continue;
|
|
80
100
|
if (filePaths[fileType]) {
|
|
81
101
|
const files = filePaths[fileType].map((filePath) => {
|
|
@@ -113,8 +113,50 @@ export async function aggregateFiles(settings) {
|
|
|
113
113
|
});
|
|
114
114
|
allFiles.push(...yamlFiles.filter((file) => file !== null));
|
|
115
115
|
}
|
|
116
|
+
// Process Twilio Content JSON files
|
|
117
|
+
if (filePaths.twilioContentJson) {
|
|
118
|
+
const twilioContentJsonFiles = filePaths.twilioContentJson
|
|
119
|
+
.map((filePath) => {
|
|
120
|
+
const content = readFile(filePath);
|
|
121
|
+
const relativePath = getRelative(filePath);
|
|
122
|
+
// Pre-validate JSON parseability
|
|
123
|
+
if (!skipValidation?.json) {
|
|
124
|
+
try {
|
|
125
|
+
JSON.parse(content);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
logger.warn(`Skipping ${relativePath}: JSON file is not parsable`);
|
|
129
|
+
recordWarning('skipped_file', relativePath, 'JSON file is not parsable');
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const parsedJson = parseJson(content, filePath, settings.options || {}, settings.defaultLocale);
|
|
134
|
+
return {
|
|
135
|
+
fileId: hashStringSync(relativePath),
|
|
136
|
+
versionId: hashStringSync(parsedJson),
|
|
137
|
+
content: parsedJson,
|
|
138
|
+
fileName: relativePath,
|
|
139
|
+
fileFormat: 'TWILIO_CONTENT_JSON',
|
|
140
|
+
dataFormat: 'STRING',
|
|
141
|
+
locale: settings.defaultLocale,
|
|
142
|
+
};
|
|
143
|
+
})
|
|
144
|
+
.filter((file) => {
|
|
145
|
+
if (!file)
|
|
146
|
+
return false;
|
|
147
|
+
if (typeof file.content !== 'string' || !file.content.trim()) {
|
|
148
|
+
logger.warn(`Skipping ${file.fileName}: JSON file is empty`);
|
|
149
|
+
recordWarning('skipped_file', file.fileName, 'JSON file is empty');
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
});
|
|
154
|
+
allFiles.push(...twilioContentJsonFiles.filter((file) => file !== null));
|
|
155
|
+
}
|
|
116
156
|
for (const fileType of SUPPORTED_FILE_EXTENSIONS) {
|
|
117
|
-
if (fileType === 'json' ||
|
|
157
|
+
if (fileType === 'json' ||
|
|
158
|
+
fileType === 'yaml' ||
|
|
159
|
+
fileType === 'twilioContentJson')
|
|
118
160
|
continue;
|
|
119
161
|
if (filePaths[fileType]) {
|
|
120
162
|
const files = filePaths[fileType]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SUPPORTED_FILE_EXTENSIONS: readonly ["json", "mdx", "md", "ts", "js", "yaml", "html", "txt"];
|
|
1
|
+
export declare const SUPPORTED_FILE_EXTENSIONS: readonly ["json", "mdx", "md", "ts", "js", "yaml", "html", "txt", "twilioContentJson"];
|
|
2
2
|
export declare const FILE_EXT_TO_EXT_LABEL: {
|
|
3
3
|
json: string;
|
|
4
4
|
mdx: string;
|
|
@@ -8,4 +8,5 @@ export declare const FILE_EXT_TO_EXT_LABEL: {
|
|
|
8
8
|
yaml: string;
|
|
9
9
|
html: string;
|
|
10
10
|
txt: string;
|
|
11
|
+
twilioContentJson: string;
|
|
11
12
|
};
|
|
@@ -7,6 +7,7 @@ export const SUPPORTED_FILE_EXTENSIONS = [
|
|
|
7
7
|
'yaml',
|
|
8
8
|
'html',
|
|
9
9
|
'txt',
|
|
10
|
+
'twilioContentJson',
|
|
10
11
|
];
|
|
11
12
|
export const FILE_EXT_TO_EXT_LABEL = {
|
|
12
13
|
json: 'JSON',
|
|
@@ -17,4 +18,5 @@ export const FILE_EXT_TO_EXT_LABEL = {
|
|
|
17
18
|
yaml: 'YAML',
|
|
18
19
|
html: 'HTML',
|
|
19
20
|
txt: 'Text',
|
|
21
|
+
twilioContentJson: 'Twilio Content JSON',
|
|
20
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "2.
|
|
1
|
+
export declare const PACKAGE_VERSION = "2.9.0";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const PACKAGE_VERSION = '2.
|
|
2
|
+
export const PACKAGE_VERSION = '2.9.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"bin": "dist/main.js",
|
|
6
6
|
"files": [
|
|
@@ -110,8 +110,8 @@
|
|
|
110
110
|
"unified": "^11.0.5",
|
|
111
111
|
"unist-util-visit": "^5.0.0",
|
|
112
112
|
"yaml": "^2.8.0",
|
|
113
|
-
"@generaltranslation/python-extractor": "0.1.
|
|
114
|
-
"generaltranslation": "8.1.
|
|
113
|
+
"@generaltranslation/python-extractor": "0.1.2",
|
|
114
|
+
"generaltranslation": "8.1.16",
|
|
115
115
|
"gt-remark": "1.0.5"
|
|
116
116
|
},
|
|
117
117
|
"devDependencies": {
|