core: fix contentNodes import

This commit is contained in:
undefined committed 2022-03-18 01:18:19 +08:00
1 parent 91a7ebb23d
commit eff13ac4f5
2 files changed
+7 -2

No files matched your search

+6 -1
View File
@@ -18,7 +18,12 @@ function findOverrideContent(dir: string) {
if (!files.length) return null;
for (const file of files) {
const lang = file.slice(8, -3);
languages[lang] = fs.readFileSync(path.join(dir, file), 'utf8');
let content: string | any[] = fs.readFileSync(path.join(dir, file), 'utf8');
try {
content = JSON.parse(content);
if (!(content instanceof Array)) content = JSON.stringify(content);
} catch (e) { }
languages[lang] = content;
}
return JSON.stringify(languages);
}