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

fixed duplicate detector

parent 89c242cf
{
"title": "Grin global application"
}
......@@ -25,8 +25,8 @@ const duplicates = new Map<string, II18n[]>();
async function main() {
console.log('Running...');
const dupes = fastGlob(['./locales/en/common.json', '../../**/src/**/translations.json', '../../**/src/translations.json'])
.then((paths) => paths.map((path) => testFile(path)));
const dupes = fastGlob(['../../**/locales/en/common.json', '../../**/src/**/translations.json', '../../**/src/translations.json'])
.then((paths) => paths.filter((path) => !path.includes('node_modules')).map((path) => testFile(path)));
console.log('Awawiting results...', dupes);
await dupes;
......@@ -61,7 +61,9 @@ const testDuplicate = (json, filePath, currentPath = undefined) => {
duplicates.set(str, [ { filePath, key: (currentPath ? `${currentPath}.` : '') + key, value: str } ]);
}
} else {
testDuplicate(value, filePath, (currentPath ? `${currentPath}.` : '') + key);
if (value) {
testDuplicate(value, filePath, (currentPath ? `${currentPath}.` : '') + key);
}
}
});
};
......
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