auto-translate-json-library 1.3.0 → 1.3.2
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/build/package.json +4 -4
- package/build/src/bin/cli.js +32 -3
- package/package.json +4 -4
package/build/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-translate-json-library",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Automatically translates JSON language files to other languages using Google Translate,AWS,Azure,DeepL or OpenAI",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
+
"auto-translate-json-library": "./build/src/bin/cli.js",
|
|
7
8
|
"atj": "./build/src/bin/cli.js"
|
|
8
9
|
},
|
|
9
10
|
"types": "./build/src/index.d.ts",
|
|
@@ -15,8 +16,7 @@
|
|
|
15
16
|
"lint-fix-all": "biome check --apply-unsafe ./src",
|
|
16
17
|
"format": "biome format ./src",
|
|
17
18
|
"format-fix": "biome format ./src --write",
|
|
18
|
-
"start": "ts-node src/index.ts"
|
|
19
|
-
"publish": "npm run build "
|
|
19
|
+
"start": "ts-node src/index.ts"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"translate",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@biomejs/biome": "1.2.2",
|
|
50
50
|
"@topce/typescript": "5.3.1",
|
|
51
51
|
"@types/minimist": "1.2.3",
|
|
52
|
-
"@types/node": "20.
|
|
52
|
+
"@types/node": "20.8.0",
|
|
53
53
|
"@types/yargs": "17.0.26",
|
|
54
54
|
"ts-node": "10.9.1"
|
|
55
55
|
},
|
package/build/src/bin/cli.js
CHANGED
|
@@ -10,7 +10,31 @@ const picocolors_1 = __importDefault(require("picocolors"));
|
|
|
10
10
|
const package_json_1 = require("../../package.json");
|
|
11
11
|
const lib_1 = require("../lib");
|
|
12
12
|
require("dotenv").config();
|
|
13
|
+
// Define a function to display the help message
|
|
14
|
+
function displayHelp() {
|
|
15
|
+
console.log(`🔨 Auto translate json cli v${package_json_1.version}`);
|
|
16
|
+
console.log(`Usage: atj [options] <inputPath>`);
|
|
17
|
+
console.log("");
|
|
18
|
+
console.log("Options:");
|
|
19
|
+
console.log(" --help, -h Display this help message");
|
|
20
|
+
console.log(" --mode, -m <mode> Specify the translation mode:file or folder");
|
|
21
|
+
console.log(" --engine, -e <engine> Specify the translation engine:aws,azure,google,deepl or openai");
|
|
22
|
+
console.log(" --sourceLocale, -s <locale> Specify the source locale");
|
|
23
|
+
console.log(" --keepTranslations, --no-keepTranslations Keep or retranslate existing translations");
|
|
24
|
+
console.log(" --keepExtraTranslations, --no-keepExtraTranslations Keep or remove extra translations");
|
|
25
|
+
console.log("");
|
|
26
|
+
console.log("Default values");
|
|
27
|
+
console.log(" --mode, -m <mode> file");
|
|
28
|
+
console.log(" --engine, -e <engine> aws");
|
|
29
|
+
console.log(" --sourceLocale, -s <locale> en");
|
|
30
|
+
console.log(" --keepTranslations, --no-keepTranslations --keepTranslations");
|
|
31
|
+
console.log(" --keepExtraTranslations, --no-keepExtraTranslations --no-keepExtraTranslations");
|
|
32
|
+
}
|
|
13
33
|
const arguments_ = process.argv.slice(2);
|
|
34
|
+
if (arguments_.length === 0) {
|
|
35
|
+
displayHelp();
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
14
38
|
const flags = (0, minimist_1.default)(arguments_, {
|
|
15
39
|
alias: {
|
|
16
40
|
mode: ["m"],
|
|
@@ -18,18 +42,23 @@ const flags = (0, minimist_1.default)(arguments_, {
|
|
|
18
42
|
keepTranslations: ["kt"],
|
|
19
43
|
keepExtraTranslations: ["ket"],
|
|
20
44
|
sourceLocale: ["s"],
|
|
45
|
+
help: ["h"],
|
|
21
46
|
},
|
|
22
47
|
string: ["mode", "engine", "sourceLocale"],
|
|
23
|
-
boolean: ["keepTranslations", "keepExtraTranslations"],
|
|
48
|
+
boolean: ["keepTranslations", "keepExtraTranslations", "help"],
|
|
24
49
|
default: {
|
|
25
|
-
engine: "
|
|
50
|
+
engine: "aws",
|
|
26
51
|
sourceLocale: "en",
|
|
27
52
|
keepTranslations: true,
|
|
28
|
-
keepExtraTranslations:
|
|
53
|
+
keepExtraTranslations: false,
|
|
29
54
|
mode: "file",
|
|
30
55
|
},
|
|
31
56
|
});
|
|
32
57
|
console.log(picocolors_1.default.green(`🔨 Auto translate json cli v${package_json_1.version}`));
|
|
58
|
+
if (flags.help) {
|
|
59
|
+
displayHelp();
|
|
60
|
+
process.exit(0);
|
|
61
|
+
}
|
|
33
62
|
const inputPath = flags._[0];
|
|
34
63
|
const { mode, engine, sourceLocale, keepTranslations, keepExtraTranslations } = flags;
|
|
35
64
|
const config = {};
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-translate-json-library",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Automatically translates JSON language files to other languages using Google Translate,AWS,Azure,DeepL or OpenAI",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
+
"auto-translate-json-library": "./build/src/bin/cli.js",
|
|
7
8
|
"atj": "./build/src/bin/cli.js"
|
|
8
9
|
},
|
|
9
10
|
"types": "./build/src/index.d.ts",
|
|
@@ -15,8 +16,7 @@
|
|
|
15
16
|
"lint-fix-all": "biome check --apply-unsafe ./src",
|
|
16
17
|
"format": "biome format ./src",
|
|
17
18
|
"format-fix": "biome format ./src --write",
|
|
18
|
-
"start": "ts-node src/index.ts"
|
|
19
|
-
"publish": "npm run build "
|
|
19
|
+
"start": "ts-node src/index.ts"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"translate",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@biomejs/biome": "1.2.2",
|
|
50
50
|
"@topce/typescript": "5.3.1",
|
|
51
51
|
"@types/minimist": "1.2.3",
|
|
52
|
-
"@types/node": "20.
|
|
52
|
+
"@types/node": "20.8.0",
|
|
53
53
|
"@types/yargs": "17.0.26",
|
|
54
54
|
"ts-node": "10.9.1"
|
|
55
55
|
},
|