mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-24 15:24:05 +00:00
28 lines
688 B
JavaScript
28 lines
688 B
JavaScript
|
// For #5231
|
||
|
|
||
|
const fs = require("fs");
|
||
|
|
||
|
let path = "./src/lang";
|
||
|
|
||
|
// list directories in the lang directory
|
||
|
let jsonFileList = fs.readdirSync(path);
|
||
|
|
||
|
for (let jsonFile of jsonFileList) {
|
||
|
if (!jsonFile.endsWith(".json")) {
|
||
|
continue;
|
||
|
}
|
||
|
|
||
|
let jsonPath = path + "/" + jsonFile;
|
||
|
let originalContent = fs.readFileSync(jsonPath, "utf8");
|
||
|
let langData = JSON.parse(originalContent);
|
||
|
|
||
|
let formattedContent = JSON.stringify(langData, null, 4) + "\n";
|
||
|
|
||
|
if (originalContent !== formattedContent) {
|
||
|
console.error(`File ${jsonFile} is not formatted correctly.`);
|
||
|
process.exit(1);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
console.log("All lang json files are formatted correctly.");
|