From 093fdafe3ecded8ebc3ffb75bbd0860afdaf5bec Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 16 Nov 2023 09:26:45 +0100 Subject: Readabilty of sitemap generation --- src/build/index.mjs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/build') diff --git a/src/build/index.mjs b/src/build/index.mjs index 63f2d6a..a2b10af 100644 --- a/src/build/index.mjs +++ b/src/build/index.mjs @@ -135,11 +135,15 @@ for (const lang in i18n) { } console.log(`Create: sitemap.xml`); + // Create a stream to write to -const stream = new SitemapStream({hostname: 'https://ache.one'}) +const stream = new SitemapStream({hostname: 'https://ache.one'}); // Return a promise that resolves with your XML string -streamToPromise(Readable.from(links).pipe(stream)).then((data) => - data.toString() -).then(sitemapXML => fs.writeFileSync("sitemap.xml", sitemapXML)); +streamToPromise( + Readable.from(links) + .pipe(stream)) + .then(data => data.toString()) + .then(sitemapXML => fs.writeFileSync("sitemap.xml", sitemapXML) +); -- cgit v1.2.3-54-g00ecf