package updates + image optimization + sourcecode beautification
All checks were successful
/ test (push) Successful in 15s
All checks were successful
/ test (push) Successful in 15s
This commit is contained in:
parent
662ac680e9
commit
caa7aaa02a
9 changed files with 94 additions and 77 deletions
26
index.ts
26
index.ts
|
|
@ -1,12 +1,15 @@
|
|||
import SSSG from "sssg";
|
||||
import SSSG, { Plugin } 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, {parseMetadata} 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 ImageOptimization from "sssg/src/plugins/image-optimization";
|
||||
|
||||
import {$} from "bun"
|
||||
import { $ } from "bun";
|
||||
|
||||
import * as path from "path";
|
||||
import * as fs from "fs";
|
||||
|
|
@ -16,19 +19,27 @@ 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 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));
|
||||
const plugins: Plugin[] = [];
|
||||
|
||||
if (process.argv.includes("--dev")) {
|
||||
plugins.push(new Dev(sssg));
|
||||
} else {
|
||||
plugins.push(new ImageOptimization());
|
||||
}
|
||||
|
||||
await sssg.run({
|
||||
plugins: [
|
||||
plugins: plugins.concat([
|
||||
new CompileTimeJS(),
|
||||
new Variables(() => {
|
||||
const variables: Record<string, string> = {
|
||||
__BLOG_POSTS__: JSON.stringify(
|
||||
fs.readdirSync("./website/blogs").map((z) => z.replace(".md", ""))
|
||||
),
|
||||
__GIT_LOG_OUTPUT__: gitLog
|
||||
__GIT_LOG_OUTPUT__: gitLog,
|
||||
};
|
||||
|
||||
if (fs.existsSync("./website/templates")) {
|
||||
|
|
@ -44,8 +55,7 @@ await sssg.run({
|
|||
new TSCompiler(),
|
||||
new MarkdownMetadata(),
|
||||
new MarkdownCompiler(),
|
||||
new Dev(sssg),
|
||||
],
|
||||
]),
|
||||
});
|
||||
|
||||
await sssg.build();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue