auto-lang 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-lang",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Automatically create language json files for internationalization",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -8,10 +8,12 @@ import translate from 'translate';
8
8
  import JsonToTS from 'json-to-ts';
9
9
  import prettier from 'prettier';
10
10
 
11
+ import pJson from '../package.json' assert { type: "json" };
11
12
  import {Logger} from './utils/Logger.mjs';
12
13
  import {validateOptions} from './utils/validation.mjs';
13
14
 
14
- const APP_VERSION = '1.0.8';
15
+ const {version: appVersion} = pJson;
16
+
15
17
 
16
18
  const program = new Command();
17
19
  const nodeMajVer = parseInt(process.version.substring(1).split('.')[0]);
@@ -25,7 +27,7 @@ if (nodeMajVer < 14) {
25
27
  program
26
28
  .name('auto-lang')
27
29
  .description('Generate translation files for multiple languages (i18n)')
28
- .version(APP_VERSION)
30
+ .version(appVersion)
29
31
  .option('-f, --from <lang>', 'language to translate from')
30
32
  .option(
31
33
  '-t, --to <lang...>',
@@ -51,7 +53,7 @@ const inputJson = JSON.parse(
51
53
  async function makeTranslatedCopy(obj1, obj2, options) {
52
54
  for (let [key, value] of Object.entries(obj1)) {
53
55
  if (typeof value === 'object') {
54
- obj2[key] = {};
56
+ obj2[key] = obj2[key] || {};
55
57
  await makeTranslatedCopy(value, obj2[key], options);
56
58
  } else {
57
59
  try {