mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
21 lines
710 B
JavaScript
21 lines
710 B
JavaScript
import { globbySync } from 'globby';
|
|
import { SitemapStream, streamToPromise } from 'sitemap';
|
|
import { Readable } from 'stream';
|
|
import fs from 'fs';
|
|
|
|
const links = [
|
|
{ url: '/', changefreq: 'daily' },
|
|
{ url: '/changelog', changefreq: 'daily' },
|
|
...globbySync(['./**/[!_]?*.md', '!node_modules', '!README.md']).map((path) => ({
|
|
url: `/${path.replace('.md', '')}`,
|
|
changefreq: 'daily',
|
|
})),
|
|
];
|
|
|
|
console.log('Sitemap entries:');
|
|
console.log(links);
|
|
|
|
const stream = new SitemapStream({ hostname: 'https://zenstack.dev' });
|
|
const content = (await streamToPromise(Readable.from(links).pipe(stream))).toString('utf-8');
|
|
|
|
fs.writeFileSync('../doc-serve/public/sitemap.xml', content);
|