From 22986c36fe3ed7ad3fe585b1da608c2e5fb2a54d Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Mon, 9 Feb 2026 00:05:15 +0300 Subject: formatting and lazy load --- scripts/generate-sitemap.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'scripts') diff --git a/scripts/generate-sitemap.ts b/scripts/generate-sitemap.ts index e521365..3270fea 100644 --- a/scripts/generate-sitemap.ts +++ b/scripts/generate-sitemap.ts @@ -12,25 +12,25 @@ const postsDir = path.join(projectRoot, 'src', 'posts'); const sitemapPath = path.join(projectRoot, 'static', 'sitemap.txt'); async function getPostRoutes(): Promise { - const files = await fs.readdir(postsDir); + const files = await fs.readdir(postsDir); - return files - .filter((file) => file.endsWith('.svx')) - .map((file) => `/posts/${file.replace(/\.svx$/, '')}`) - .sort(); + return files + .filter((file) => file.endsWith('.svx')) + .map((file) => `/posts/${file.replace(/\.svx$/, '')}`) + .sort(); } async function main(): Promise { - const postRoutes = await getPostRoutes(); - const urls = [...STATIC_ROUTES, ...postRoutes].map((route) => `${SITE_URL}${route}`); - const body = `${urls.join('\n')}\n`; + const postRoutes = await getPostRoutes(); + const urls = [...STATIC_ROUTES, ...postRoutes].map((route) => `${SITE_URL}${route}`); + const body = `${urls.join('\n')}\n`; - await fs.writeFile(sitemapPath, body, 'utf8'); - console.log(`Generated sitemap: ${path.relative(projectRoot, sitemapPath)} (${urls.length} URLs)`); + await fs.writeFile(sitemapPath, body, 'utf8'); + console.log(`Generated sitemap: ${path.relative(projectRoot, sitemapPath)} (${urls.length} URLs)`); } main().catch((error: unknown) => { - console.error('Failed to generate sitemap.txt'); - console.error(error); - process.exit(1); + console.error('Failed to generate sitemap.txt'); + console.error(error); + process.exit(1); }); -- cgit v1.2.3