diff --git a/.drone.yml b/.drone.yml index 32d4e77..e24d0c3 100644 --- a/.drone.yml +++ b/.drone.yml @@ -23,10 +23,6 @@ steps: - senpai commands: - sed -i '$s/$/,latest/' .tags -- name: submodules - image: alpine/git - commands: - - git submodule update --init --recursive - name: build-image image: plugins/docker settings: diff --git a/.gitmodules b/.gitmodules index ea46809..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "public/content"] - path = public/content - url = https://git.c0ntroller.de/c0ntroller/frontpage-content.git diff --git a/lib/content/generateBackend.ts b/lib/content/generateBackend.ts index 3a1d594..95d774d 100644 --- a/lib/content/generateBackend.ts +++ b/lib/content/generateBackend.ts @@ -1,7 +1,7 @@ // This file is used to generate the HTML for the projects and diaries in the backend. // We can use fs and stuff here. -import { readdirSync } from "fs"; +import { Dirent, readdirSync } from "fs"; import { readFile } from "node:fs/promises"; import { resolve } from "path"; import type { Project, Diary } from "./types"; @@ -16,10 +16,17 @@ const ad = asciidoctor(); const listPath = resolve("./public", "content", "list.json"); const projectPath = resolve("./public", "content", "projects"); const diaryPath = resolve("./public", "content", "diaries"); -// No error catching here as we are screwed if this fails -const projectFiles = readdirSync(projectPath, { withFileTypes: true }).filter((f) => f.isFile() && f.name.endsWith(".adoc")); +// Error catching as this is evaluated at build time +let pf: Dirent[] = []; +let df: Dirent[] = []; +try { pf = readdirSync(projectPath, { withFileTypes: true }).filter((f) => f.isFile() && f.name.endsWith(".adoc")) } +catch {} // As we need the diaries too, no filter here -const diaryFiles = readdirSync(diaryPath, { withFileTypes: true }); +try { df = readdirSync(diaryPath, { withFileTypes: true }) } +catch {} + +const projectFiles = pf; +const diaryFiles = df; export async function getContentList() { try { diff --git a/public/content b/public/content deleted file mode 160000 index 998c196..0000000 --- a/public/content +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 998c1962b606ca58dad6eaed457a8f89df6b250b