auto-translate-json-library 1.3.0 → 1.3.1

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.
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "auto-translate-json-library",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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.7.2",
52
+ "@types/node": "20.8.0",
53
53
  "@types/yargs": "17.0.26",
54
54
  "ts-node": "10.9.1"
55
55
  },
@@ -10,7 +10,25 @@ 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, folder, etc.)");
21
+ console.log(" --engine, -e <engine> Specify the translation engine (google, aws, etc.)");
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
+ }
13
27
  const arguments_ = process.argv.slice(2);
28
+ if (arguments_.length === 0) {
29
+ displayHelp();
30
+ process.exit(0);
31
+ }
14
32
  const flags = (0, minimist_1.default)(arguments_, {
15
33
  alias: {
16
34
  mode: ["m"],
@@ -18,9 +36,10 @@ const flags = (0, minimist_1.default)(arguments_, {
18
36
  keepTranslations: ["kt"],
19
37
  keepExtraTranslations: ["ket"],
20
38
  sourceLocale: ["s"],
39
+ help: ["h"],
21
40
  },
22
41
  string: ["mode", "engine", "sourceLocale"],
23
- boolean: ["keepTranslations", "keepExtraTranslations"],
42
+ boolean: ["keepTranslations", "keepExtraTranslations", "help"],
24
43
  default: {
25
44
  engine: "google",
26
45
  sourceLocale: "en",
@@ -30,6 +49,10 @@ const flags = (0, minimist_1.default)(arguments_, {
30
49
  },
31
50
  });
32
51
  console.log(picocolors_1.default.green(`🔨 Auto translate json cli v${package_json_1.version}`));
52
+ if (flags.help) {
53
+ displayHelp();
54
+ process.exit(0);
55
+ }
33
56
  const inputPath = flags._[0];
34
57
  const { mode, engine, sourceLocale, keepTranslations, keepExtraTranslations } = flags;
35
58
  const config = {};
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "auto-translate-json-library",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
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.7.2",
52
+ "@types/node": "20.8.0",
53
53
  "@types/yargs": "17.0.26",
54
54
  "ts-node": "10.9.1"
55
55
  },