diff --git a/build_garden.js b/build_garden.js index 4dad53ac..50818740 100644 --- a/build_garden.js +++ b/build_garden.js @@ -318,4 +318,15 @@ ${entries.join("\n\n")} fd = fs.openSync("site/public/changelog/json", "w+"); fs.writeSync(fd, feed.json1()); fs.closeSync(fd); + + // Update commit info in footer + const commitLink = (await exec(`git log -n 1 --format="https://code.incremental.social/thepaperpilot/pages/commit/%H"`)).stdout.replaceAll(/\n$/g, ''); + const commitTime = (await exec(`git log -n 1 --date=format:"%A, %B %d, %Y at %X" --format=%ad`)).stdout.replaceAll(/\n$/g, ''); + + fd = fs.openSync("site/.vitepress/theme/Layout.vue", "w+"); + let layoutData = fs.readFileSync("site/.vitepress/theme/Layout.vue.in").toString(); + layoutData = layoutData.replace(/COMMIT_LINK/g, commitLink); + layoutData = layoutData.replace(/COMMIT_TIME/g, commitTime); + fs.writeSync(fd, layoutData); + fs.closeSync(fd); })(); diff --git a/site/.vitepress/theme/.gitignore b/site/.vitepress/theme/.gitignore new file mode 100644 index 00000000..3e0cd26a --- /dev/null +++ b/site/.vitepress/theme/.gitignore @@ -0,0 +1 @@ +Layout.vue \ No newline at end of file diff --git a/site/.vitepress/theme/Layout.vue b/site/.vitepress/theme/Layout.vue.in similarity index 66% rename from site/.vitepress/theme/Layout.vue rename to site/.vitepress/theme/Layout.vue.in index f8956383..80a90a70 100644 --- a/site/.vitepress/theme/Layout.vue +++ b/site/.vitepress/theme/Layout.vue.in @@ -8,7 +8,7 @@
CC {{ new Date().getFullYear() }} The Paper Pilot. CC BY-NC-SA 4.0.
Any and all opinions listed here are my own and not representative of my employers; future, past and present.
Resume (not actively seeking new opportunities).
-
Site built from this commit on .
+
Site built from this commit on .
@@ -19,16 +19,6 @@ import DefaultTheme from 'vitepress/theme' import { NolebaseHighlightTargetedHeading } from '@nolebase/vitepress-plugin-highlight-targeted-heading/client' import '@nolebase/vitepress-plugin-highlight-targeted-heading/client/style.css' import './custom.css' - -import fs from "fs" -import path from "path" - -import util from 'node:util' -import child_process from 'node:child_process'; -const exec = util.promisify(child_process.exec); - -const commitLink = (await exec(`git log -n 1 --format="https://code.incremental.social/thepaperpilot/pages/commit/%H"`)).stdout.replaceAll(/\n$/g, ''); -const commitTime = (await exec(`git log -n 1 --date=format:"%A, %B %d, %Y at %X" --format=%ad`)).stdout.replaceAll(/\n$/g, '');