This commit is contained in:
Leandro Facchinetti 2020-03-21 12:05:51 -04:00
parent e7af13fd9b
commit 2138af838d
1 changed files with 17 additions and 0 deletions

17
src/verify.tsx Normal file
View File

@ -0,0 +1,17 @@
import xml2js from "xml2js";
import fs from "fs";
(async () => {
for (const feed of fs
.readdirSync("static/feeds")
.filter(file => !file.startsWith(".")))
try {
const xml = await new xml2js.Parser().parseStringPromise(
fs.readFileSync(`static/feeds/${feed}`, "utf8")
);
if (xml?.feed?.updated === undefined)
throw new Error("Cant find xml.feed.updated");
} catch (error) {
console.log(`Error for ${feed}: ${error}`);
}
})();