Fix build issue
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m5s

This commit is contained in:
thepaperpilot 2024-06-15 09:50:22 -05:00
parent e7fdcdc2aa
commit ba419df6ed
4 changed files with 41 additions and 34 deletions

View file

@ -49,8 +49,8 @@ module.exports = {
const pageStart = code.indexOf("</h1>");
const firstCommit = (await exec(`git log -n 1 --diff-filter=A --format="<a href='https://code.incremental.social/thepaperpilot/pages/commit/%H' title='%ad'><time class='dt-published' datetime='%ad'>%ar</time></a>" site/${context.page}`)).stdout;
const lastCommit = (await exec(`git log -n 1 --diff-filter=M --format="<a href='https://code.incremental.social/thepaperpilot/pages/commit/%H' title='%ad'><time class='dt-updated' datetime='%ad'>%ar</time></a>" site/${context.page}`)).stdout;
const header = code.slice(0, pageStart < 0 ? 0 : pageStart + 5).replace('<h1 ', '<h1 class="p-name" ');
return `<article class="h-entry">${header + `<p>${wc} words, ~${Math.round(wc / 183)} minute read. Planted ${firstCommit}.${lastCommit ? ` Last tended to ${lastCommit}.` : ''}</p><hr/><div class="e-content">` + code.slice(pageStart + 5)}</div></article>`;
const header = code.slice(0, pageStart < 0 ? 0 : pageStart + 5).replace('<h1 ', '<article class="h-entry"><h1 class="p-name" ');
return header + `<p>${wc} words, ~${Math.round(wc / 183)} minute read. Planted ${firstCommit}.${lastCommit ? ` Last tended to ${lastCommit}.` : ''}</p><hr/><div class="e-content">` + code.slice(pageStart + 5).replace('</main>', '</div></article></main>');
}
return code;
},

View file

@ -0,0 +1,32 @@
<template>
<DefaultTheme.Layout>
<template #layout-top>
<NolebaseHighlightTargetedHeading />
</template>
<template #layout-bottom>
<footer>
<div>CC {{ new Date().getFullYear() }} The Paper Pilot. <a 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>
</footer>
</template>
</DefaultTheme.Layout>
</template>
<script setup lang="tsx">
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;
const commitTime = (await exec(`git log -n 1 --date=format:"%A, %B %d, %Y at %X" --format=%ad`)).stdout;
</script>

View file

@ -0,0 +1,7 @@
import DefaultTheme from 'vitepress/theme';
import Layout from './Layout.vue';
export default {
...DefaultTheme,
Layout
};

View file

@ -1,32 +0,0 @@
import DefaultTheme from 'vitepress/theme'
import { h } from "vue"
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);
export default {
...DefaultTheme,
Layout: async () => {
const commitLink = (await exec(`git log -n 1 --format="https://code.incremental.social/thepaperpilot/pages/commit/%H"`)).stdout;
const commitTime = (await exec(`git log -n 1 --format="%ar"`)).stdout;
return h(DefaultTheme.Layout, null, {
'layout-top': () => [
h(NolebaseHighlightTargetedHeading)
],
'layout-bottom': <footer>
<div>CC { new Date().getYear() } The Paper Pilot. <a 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>
</footer>
})
}
};