gtx-cli 2.5.9 → 2.5.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.5.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#825](https://github.com/generaltranslation/gt/pull/825) [`a9bdf21`](https://github.com/generaltranslation/gt/commit/a9bdf21d9ec80edc190b32b963dfe19c5fe2ea33) Thanks [@brian-lou](https://github.com/brian-lou)! - Fix init write files
|
|
8
|
+
|
|
3
9
|
## 2.5.9
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -29,12 +29,18 @@ export default async function loadTranslations(locale) {
|
|
|
29
29
|
`;
|
|
30
30
|
await fs.promises.writeFile(filePath, loadTranslationsContent);
|
|
31
31
|
logger.info(`Created ${chalk.cyan('loadTranslations.js')} file at ${chalk.cyan(filePath)}.`);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
try {
|
|
33
|
+
await fs.promises.mkdir(translationsDir, { recursive: true });
|
|
34
|
+
// Create empty JSON files
|
|
35
|
+
for (const locale of locales) {
|
|
36
|
+
if (fs.existsSync(path.join(translationsDir, `${locale}.json`))) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
await fs.promises.writeFile(path.join(translationsDir, `${locale}.json`), '{}');
|
|
36
40
|
}
|
|
37
|
-
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
logger.error(`Failed to create translations directory: ${error}`);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
else {
|
package/dist/setup/userInput.js
CHANGED
|
@@ -17,6 +17,9 @@ export async function getDesiredLocales() {
|
|
|
17
17
|
if (localeList.length === 0) {
|
|
18
18
|
return 'Please enter at least one locale';
|
|
19
19
|
}
|
|
20
|
+
if (localeList.some((locale) => !locale.trim())) {
|
|
21
|
+
return 'Please enter a valid locale (e.g., en, fr, es)';
|
|
22
|
+
}
|
|
20
23
|
for (const locale of localeList) {
|
|
21
24
|
if (!gt.isValidLocale(locale)) {
|
|
22
25
|
return 'Please enter a valid locale (e.g., en, fr, es)';
|