Commit c8aafe4f authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

fixed duplicate detector

parent ae6e41e5
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"clean": "rimraf lib", "clean": "rimraf lib",
"build": "yarn run i18nGenerate && tsc", "build": "yarn run i18nGenerate && tsc",
"i18nGenerate": "gg-i18n --moduleName=client", "i18nGenerate": "gg-i18n --moduleName=client",
"i18nFindDuplicate": "gg-i18n-dd",
"test": "jest" "test": "jest"
}, },
"dependencies": { "dependencies": {
......
...@@ -5,6 +5,8 @@ const fileStream = require('fs'); ...@@ -5,6 +5,8 @@ const fileStream = require('fs');
const path = require('path'); const path = require('path');
const readlineSync = require('readline-sync'); const readlineSync = require('readline-sync');
const rootDirectory = process.cwd();
class II18n { class II18n {
public filePath: string; public filePath: string;
public key: string; public key: string;
...@@ -27,7 +29,7 @@ const duplicates = new Map<string, II18n[]>(); ...@@ -27,7 +29,7 @@ const duplicates = new Map<string, II18n[]>();
async function main() { async function main() {
console.log('Running...'); console.log('Running...');
const dupes = fastGlob(['../../**/locales/en/common.json', '../../**/src/**/translations.json', '../../**/src/translations.json']) const dupes = fastGlob([`${rootDirectory}/locales/en/common.json`, `${rootDirectory}/src/**/translations.json`, `${rootDirectory}/src/translations.json`])
.then((paths) => paths.filter((path) => !path.includes('node_modules')).map((path) => testFile(path))); .then((paths) => paths.filter((path) => !path.includes('node_modules')).map((path) => testFile(path)));
console.log('Awawiting results...', dupes); console.log('Awawiting results...', dupes);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment