committed by
Bastian
parent
9a8bb235a4
commit
caff3640a2
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
import { copyFileSync, existsSync, mkdirSync, readFileSync } from "fs";
|
||||
|
||||
import { copyFileSync, mkdirSync, existsSync, readFileSync, writeFileSync } from "fs";
|
||||
import XmlSitemap from "xml-sitemap";
|
||||
import { createRadar } from "./generateJson/radar";
|
||||
|
||||
// Do this as the first thing so that any code reading it knows the right env.
|
||||
@@ -22,6 +22,7 @@ const createStaticFiles = async () => {
|
||||
copyFileSync("build/index.html", "build/help-and-about-tech-radar.html");
|
||||
const rawConf = readFileSync("build/config.json", "utf-8");
|
||||
const config = JSON.parse(rawConf);
|
||||
|
||||
Object.keys(config.quadrants).forEach((quadrant) => {
|
||||
const destFolder = `build/${quadrant}`;
|
||||
copyFileSync("build/index.html", `${destFolder}.html`);
|
||||
@@ -29,12 +30,22 @@ const createStaticFiles = async () => {
|
||||
mkdirSync(destFolder);
|
||||
}
|
||||
});
|
||||
|
||||
const sitemap = new XmlSitemap();
|
||||
|
||||
radar.items.forEach((item) => {
|
||||
copyFileSync(
|
||||
"build/index.html",
|
||||
`build/${item.quadrant}/${item.name}.html`
|
||||
);
|
||||
|
||||
sitemap.add(`${process.env.PUBLIC_URL}/${item.quadrant}/${item.name}.html`, {
|
||||
lastmod: 'now',
|
||||
changefreq: 'weekly'
|
||||
});
|
||||
});
|
||||
|
||||
writeFileSync("build/sitemap.xml", sitemap.xml);
|
||||
};
|
||||
|
||||
createStaticFiles()
|
||||
|
||||
1
scripts/types.d.ts
vendored
Normal file
1
scripts/types.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare module 'xml-sitemap';
|
||||
Reference in New Issue
Block a user