add git log widget
All checks were successful
/ test (push) Successful in 18s

This commit is contained in:
Soph :3 2024-08-29 23:16:35 +03:00
parent 1efaf2f0b1
commit f75305ebfe
Signed by: sophie
GPG key ID: EDA5D222A0C270F2
5 changed files with 64 additions and 7 deletions

View file

@ -2,10 +2,12 @@ import SSSG from "sssg";
import Variables from "sssg/src/plugins/variables";
import Dev from "sssg/src/plugins/dev";
import TSCompiler from "sssg/src/plugins/ts-compiler";
import MarkdownMetadata from "sssg/src/plugins/markdown-metadata";
import MarkdownMetadata, {parseMetadata} from "sssg/src/plugins/markdown-metadata";
import MarkdownCompiler from "sssg/src/plugins/markdown-compiler";
import CompileTimeJS from "sssg/src/plugins/compile-time-js";
import {$} from "bun"
import * as path from "path";
import * as fs from "fs";
@ -14,6 +16,10 @@ const sssg = new SSSG({
inputFolder: path.join(__dirname, "website"),
});
const gitLogShell = await $`git log --pretty=format:'commit=%H%nauthor=%aN <%aE>%ndate=%ad%nmessage=%s%n=========' -1`.quiet()
const gitLogOutput = gitLogShell.text("utf8");
const gitLog = JSON.stringify(parseMetadata(gitLogOutput));
await sssg.run({
plugins: [
new CompileTimeJS(),
@ -22,6 +28,7 @@ await sssg.run({
__BLOG_POSTS__: JSON.stringify(
fs.readdirSync("./website/blogs").map((z) => z.replace(".md", ""))
),
__GIT_LOG_OUTPUT__: gitLog
};
if (fs.existsSync("./website/templates")) {