diff --git a/assets/styles/styles.css b/assets/styles/styles.css index b55c629..54b9f95 100644 --- a/assets/styles/styles.css +++ b/assets/styles/styles.css @@ -270,6 +270,31 @@ main.area { white-space: nowrap; } +main.changelog { + min-height: 0; + background: #fff; + color: #333; +} + +main.changelog * { + text-transform: none; +} + +main.changelog a { + color: #333; + border-bottom: 1px solid #333; +} + +main.changelog a:hover { + color: #aaa; + border-bottom: 1px solid #aaa; +} + +main.changelog section { + border-left: none; + padding-left: 0; +} + main.coding { min-height: 0; background: rgb(78, 0, 72); @@ -356,6 +381,16 @@ footer .copy { font-size: 0.8em; } +footer .copy a { + color: #777; + border-bottom: 1px solid #777; +} + +footer .copy a:hover { + color: #ccc; + border-bottom: 1px solid #ccc; +} + .flexme { flex-wrap: wrap; display: flex; diff --git a/package.json b/package.json index 864b405..df16b98 100644 --- a/package.json +++ b/package.json @@ -5,8 +5,8 @@ "main": "index.js", "scripts": { "dev": "nodemon", - "build": "mkdir -p ./public && npm run build:css && npm run build:favicons && npm run build:pages && npm run build:images && npm run build:thoughts && npm run build:sitemap", - "build:dev": "mkdir -p ./public && npm run build:css && npm run build:pages && npm run build:images && npm run build:thoughts", + "build": "mkdir -p ./public && npm run build:css && npm run build:favicons && npm run build:pages && npm run build:images && npm run build:thoughts && npm run build:sitemap && npm run build:changelog", + "build:dev": "mkdir -p ./public && npm run build:css && npm run build:pages && npm run build:images && npm run build:thoughts && npm run build:changelog", "build:pages": "ts-node ./scripts/generatePages", "build:css": "cleancss -o ./public/styles.min.css ./assets/styles/*.css", "build:favicons": "favicons-generate", @@ -15,7 +15,7 @@ "build:changelog": "ts-node ./scripts/generateChangelog", "build:thoughts": "mkdir -p ./public/thoughts && ts-node ./scripts/generateThoughts", "release": "standard-version", - "rbp": "npm run release && npm run build &&" + "rp": "npm run release && git push --follow-tags origin master" }, "repository": { "type": "git", diff --git a/pages/changelog.html b/pages/changelog.html new file mode 100644 index 0000000..3b27812 --- /dev/null +++ b/pages/changelog.html @@ -0,0 +1,18 @@ + + + + {head.html} + + + {nav.html} + +
+

What changes have happened to this site?

+
+ {changelog} +
+
+ + {footer.html} + + diff --git a/scripts/generateChangelog.ts b/scripts/generateChangelog.ts new file mode 100644 index 0000000..5e61872 --- /dev/null +++ b/scripts/generateChangelog.ts @@ -0,0 +1,37 @@ +import * as fs from "fs"; +import showdown from "showdown"; + +import findInDir from "./findInDir"; + +console.log("/// Beginning changelog generation"); + +const CHANGELOG_HTML_LOCATION = "./public/changelog.html"; + +const changelogMdContent = fs.readFileSync("./CHANGELOG.md", "utf8"); +let changelogHtmlContent = fs.readFileSync(CHANGELOG_HTML_LOCATION, "utf8"); + +const mdConverter = new showdown.Converter(); + +const changelogContent = mdConverter.makeHtml(changelogMdContent); +changelogHtmlContent = changelogHtmlContent.replace( + "{changelog}", + changelogContent +); + +fs.writeFileSync(CHANGELOG_HTML_LOCATION, changelogHtmlContent, "utf8"); + +const versionMatch = changelogMdContent.match( + /## ((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?)/ +); + +const version = + versionMatch && versionMatch.length > 2 ? versionMatch[1] : "ER.RO.R"; + +const pages = findInDir("./public", ".html"); + +pages.forEach((page) => { + const pageContent = fs.readFileSync(page, "utf8"); + fs.writeFileSync(page, pageContent.replace("{version}", version), "utf8"); +}); + +console.log("/// Finished changelog generation"); diff --git a/scripts/generatePages.ts b/scripts/generatePages.ts index 50d5691..8870b18 100644 --- a/scripts/generatePages.ts +++ b/scripts/generatePages.ts @@ -27,6 +27,9 @@ pages.forEach((page) => { case "coding": description = "Shall we take a look at some projects I've done?"; break; + case "changelog": + description = "What changes have happened to this site?"; + break; default: // do nothing - already set description for home/index } diff --git a/scripts/generateSitemap.ts b/scripts/generateSitemap.ts index bfbb881..1449925 100644 --- a/scripts/generateSitemap.ts +++ b/scripts/generateSitemap.ts @@ -45,10 +45,16 @@ const generateUrlElement = (loc: string) => { if (loc.indexOf("thoughts/") > -1) { // is an article/subpage - prio = "0.5"; + prio = "1"; changefreq = "yearly"; } + if (loc.indexOf("changelog") > 1) { + // it's the changelog + prio = "0.1"; + changefreq = "weekly"; + } + console.log(loc, prio, changefreq); return { diff --git a/templates/footer.html b/templates/footer.html index d49caf2..76c79be 100644 --- a/templates/footer.html +++ b/templates/footer.html @@ -46,5 +46,7 @@ -

© 2020 James King

+

+ v{version} © 2020 James King +