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.
16 lines
476 B
16 lines
476 B
2 years ago
|
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");
|
||
|
})()
|