From dc2c4dca0845aa9666a7c7d7eb56265df252f82f Mon Sep 17 00:00:00 2001
From: badcode <alitokurr@gmail.com>
Date: Tue, 29 Apr 2025 16:55:15 +0000
Subject: [PATCH] docs: add fix for 'remote end hung up unexpectedly' error during initial sync (#1939)
---
quartz/plugins/emitters/static.ts | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/quartz/plugins/emitters/static.ts b/quartz/plugins/emitters/static.ts
index 7e4af15..0b45290 100644
--- a/quartz/plugins/emitters/static.ts
+++ b/quartz/plugins/emitters/static.ts
@@ -1,21 +1,23 @@
-import { globby } from "globby"
-import {
- FilePath, QUARTZ
-} from "../../path"
+import { FilePath, QUARTZ, joinSegments } from "../../util/path"
import { QuartzEmitterPlugin } from "../types"
-import path from "path"
import fs from "fs"
-
+import { glob } from "../../util/glob"
+import { dirname } from "path"
export const Static: QuartzEmitterPlugin = () => ({
name: "Static",
- getQuartzComponents() {
- return []
+ async *emit({ argv, cfg }) {
+ const staticPath = joinSegments(QUARTZ, "static")
+ const fps = await glob("**", staticPath, cfg.configuration.ignorePatterns)
+ const outputStaticPath = joinSegments(argv.output, "static")
+ await fs.promises.mkdir(outputStaticPath, { recursive: true })
+ for (const fp of fps) {
+ const src = joinSegments(staticPath, fp) as FilePath
+ const dest = joinSegments(outputStaticPath, fp) as FilePath
+ await fs.promises.mkdir(dirname(dest), { recursive: true })
+ await fs.promises.copyFile(src, dest)
+ yield dest
+ }
},
- async emit({ argv }, _content, _resources, _emit): Promise<FilePath[]> {
- const staticPath = path.join(QUARTZ, "static")
- const fps = await globby("*", { cwd: staticPath })
- await fs.promises.cp(staticPath, path.join(argv.output, "static"), { recursive: true })
- return fps.map(fp => path.join("static", fp)) as FilePath[]
- },
+ async *partialEmit() {},
})
--
Gitblit v1.10.0