From 2138af838d9b829145f24d789c32ca32d4bb671c Mon Sep 17 00:00:00 2001 From: Leandro Facchinetti Date: Sat, 21 Mar 2020 12:05:51 -0400 Subject: [PATCH] . --- src/verify.tsx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/verify.tsx diff --git a/src/verify.tsx b/src/verify.tsx new file mode 100644 index 0000000..80cf488 --- /dev/null +++ b/src/verify.tsx @@ -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("Can’t find xml.feed.updated"); + } catch (error) { + console.log(`Error for ${feed}: ${error}`); + } +})();