Don't use node stuff in Layout.vue
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m2s

This commit is contained in:
thepaperpilot 2024-06-17 00:08:45 -05:00
parent fdd8312d4c
commit 5632b8a6fd
3 changed files with 13 additions and 11 deletions

View file

@ -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);
})();

1
site/.vitepress/theme/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
Layout.vue

View file

@ -8,7 +8,7 @@
<div>CC {{ new Date().getFullYear() }} The Paper Pilot. <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a>.</div>
<div>Any and all opinions listed here are my own and not representative of my employers; future, past and present.</div>
<div><a href="https://resume.incremental.social/thepaperpilot/thepaperpilot">Resume</a> (not actively seeking new opportunities).</div>
<div>Site built from <a :href="commitLink">this commit</a> on <time>{{ commitTime }}</time>.</div>
<div>Site built from <a href="COMMIT_LINK">this commit</a> on <time>COMMIT_TIME</time>.</div>
</footer>
</template>
</DefaultTheme.Layout>
@ -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, '');
</script>
<style scoped>