You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vscode-api-cn.js/sitemap.js

16 lines
476 B

const fs = require("fs");
const recursive = require("recursive-readdir");
const execSh = require("exec-sh");
(async () =>{
if (!fs.existsSync("./docs")) {
return;
}
const files = await recursive("./docs");
const urls = files.filter(file => file.endsWith('.html')).map(file => {
return file.replace('docs/', 'https://vscode-api-cn.js.org/')
})
fs.writeFileSync("./docs/urls.txt", urls.join("\n"));
execSh("npx sitemap < ./docs/urls.txt > ./docs/sitemap.xml");
})()