From f1d1761fd7970d74dfb441edcaa88c1498aa9a0b Mon Sep 17 00:00:00 2001 From: lotte Date: Thu, 23 Apr 2020 14:14:29 +0200 Subject: [PATCH] sync i18n script --- package.json | 4 +++- scripts/{sync-i18n-files.js => sync-i18n-files.ts} | 7 +++---- yarn.lock | 12 ++++++++++-- 3 files changed, 16 insertions(+), 7 deletions(-) rename scripts/{sync-i18n-files.js => sync-i18n-files.ts} (98%) diff --git a/package.json b/package.json index 69352a0ed6..d89a9c596e 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "clean:node": "rimraf node_modules", "clean:prod": "yarn run clean:coverage && yarn run clean:doc && yarn run clean:dist && yarn run clean:log && yarn run clean:json && yarn run clean:bld", "clean": "yarn run clean:prod && yarn run clean:node && yarn run clean:env", - "clean:env": "rimraf src/environments/environment.ts" + "clean:env": "rimraf src/environments/environment.ts", + "sync-i18n": "ts-node --project ./tsconfig.ts-node.json scripts/sync-i18n-files.ts" }, "browser": { "fs": false, @@ -76,6 +77,7 @@ "bootstrap": "4.3.1", "caniuse-lite": "^1.0.30000697", "cerialize": "0.1.18", + "cli-progress": "^3.8.0", "cookie-parser": "1.4.3", "core-js": "^3.6.4", "debug-loader": "^0.0.1", diff --git a/scripts/sync-i18n-files.js b/scripts/sync-i18n-files.ts similarity index 98% rename from scripts/sync-i18n-files.js rename to scripts/sync-i18n-files.ts index b1e8062a67..ad8a712f21 100755 --- a/scripts/sync-i18n-files.js +++ b/scripts/sync-i18n-files.ts @@ -1,10 +1,9 @@ -#!/usr/bin/env node +import { projectRoot} from '../webpack/helpers'; const commander = require('commander'); const fs = require('fs'); const JSON5 = require('json5'); const _cliProgress = require('cli-progress'); const _ = require('lodash'); -const {projectRoot} = require('../webpack/helpers'); const program = new commander.Command(); program.version('1.0.0', '-v, --version'); @@ -13,8 +12,8 @@ const NEW_MESSAGE_TODO = '// TODO New key - Add a translation'; const MESSAGE_CHANGED_TODO = '// TODO Source message changed - Revise the translation'; const COMMENTS_CHANGED_TODO = '// TODO Source comments changed - Revise the translation'; -const DEFAULT_SOURCE_FILE_LOCATION = 'resources/i18n/en.json5'; -const LANGUAGE_FILES_LOCATION = 'resources/i18n'; +const DEFAULT_SOURCE_FILE_LOCATION = 'src/assets/i18n/en.json5'; +const LANGUAGE_FILES_LOCATION = 'src/assets/i18n'; parseCliInput(); diff --git a/yarn.lock b/yarn.lock index 85b29cf352..7bac684f7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2595,6 +2595,14 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" +cli-progress@^3.8.0: + version "3.8.0" + resolved "https://registry.yarnpkg.com/cli-progress/-/cli-progress-3.8.0.tgz#81ba8cf008b9b211805f3396b8cfcd0283646d6e" + integrity sha512-3e+m7ecKbVTF2yo186vrrt/5217ZwE64z61kMwhSFmgrF3qZiTUuV9Fdh2RyzSkhLRfsqFf721KiUDEAJlP5pA== + dependencies: + colors "^1.1.2" + string-width "^4.2.0" + cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" @@ -2744,7 +2752,7 @@ colors@1.1.2: resolved "https://registry.yarnpkg.com/colors/-/colors-1.1.2.tgz#168a4701756b6a7f51a12ce0c97bfa28c084ed63" integrity sha1-FopHAXVran9RoSzgyXv6KMCE7WM= -colors@^1.1.0: +colors@^1.1.0, colors@^1.1.2: version "1.4.0" resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== @@ -9875,7 +9883,7 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0: +string-width@^4.1.0, string-width@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==