summaryrefslogtreecommitdiffhomepage
path: root/services/blog/nuldoc-src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'services/blog/nuldoc-src/commands')
-rw-r--r--services/blog/nuldoc-src/commands/build.ts32
1 files changed, 29 insertions, 3 deletions
diff --git a/services/blog/nuldoc-src/commands/build.ts b/services/blog/nuldoc-src/commands/build.ts
index 3f765441..8c8de8f5 100644
--- a/services/blog/nuldoc-src/commands/build.ts
+++ b/services/blog/nuldoc-src/commands/build.ts
@@ -1,4 +1,4 @@
-import { dirname, join, joinGlobs } from "@std/path";
+import { dirname, join, joinGlobs, relative } from "@std/path";
import { ensureDir, expandGlob } from "@std/fs";
import { generateFeedPageFromEntries } from "../generators/atom.ts";
import { Config, getTagLabel } from "../config.ts";
@@ -34,7 +34,8 @@ export async function runBuildCommand(config: Config) {
await buildNotFoundPage(config);
await buildFeedOfAllContents(posts, slides, config);
await copyStaticFiles(config);
- await copyAssetFiles(slides, config);
+ await copySlidesFiles(slides, config);
+ await copyAssetFiles(config);
}
async function buildPostPages(config: Config): Promise<PostPage[]> {
@@ -236,7 +237,7 @@ async function copyStaticFiles(config: Config) {
}
}
-async function copyAssetFiles(slides: SlidePage[], config: Config) {
+async function copySlidesFiles(slides: SlidePage[], config: Config) {
const cwd = Deno.cwd();
const contentDir = join(cwd, config.locations.contentDir);
const destDir = join(cwd, config.locations.destDir);
@@ -249,6 +250,31 @@ async function copyAssetFiles(slides: SlidePage[], config: Config) {
}
}
+async function copyAssetFiles(config: Config) {
+ const cwd = Deno.cwd();
+ const contentDir = join(cwd, config.locations.contentDir);
+ const destDir = join(cwd, config.locations.destDir);
+
+ const globPattern = joinGlobs([contentDir, "**", "*"]);
+ for await (const { isFile, path } of expandGlob(globPattern)) {
+ if (!isFile) continue;
+
+ // Skip .dj, .toml, .pdf files
+ if (
+ path.endsWith(".dj") ||
+ path.endsWith(".toml") ||
+ path.endsWith(".pdf")
+ ) {
+ continue;
+ }
+
+ const src = path;
+ const dst = join(destDir, relative(contentDir, path));
+ await ensureDir(dirname(dst));
+ await Deno.copyFile(src, dst);
+ }
+}
+
async function writePage(page: Page, config: Config) {
const destFilePath = join(
Deno.cwd(),