From 78b33fc2fb2d2b30e0cdf6fbd50c74efceac1c56 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 18 Dec 2023 00:46:17 +0000
Subject: [PATCH] fix: release build lock before client refresh

---
 quartz/build.ts |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/quartz/build.ts b/quartz/build.ts
index 58137d1..0ebc529 100644
--- a/quartz/build.ts
+++ b/quartz/build.ts
@@ -45,7 +45,7 @@
 
   perf.addEvent("glob")
   const allFiles = await glob("**/*.*", argv.directory, cfg.configuration.ignorePatterns)
-  const fps = allFiles.filter((fp) => fp.endsWith(".md"))
+  const fps = allFiles.filter((fp) => fp.endsWith(".md")).sort()
   console.log(
     `Found ${fps.length} input files from \`${argv.directory}\` in ${perf.timeSince("glob")}`,
   )
@@ -142,6 +142,7 @@
 
       const parsedFiles = [...contentMap.values()]
       const filteredContent = filterContent(ctx, parsedFiles)
+
       // TODO: we can probably traverse the link graph to figure out what's safe to delete here
       // instead of just deleting everything
       await rimraf(argv.output)
@@ -151,10 +152,10 @@
       console.log(chalk.yellow(`Rebuild failed. Waiting on a change to fix the error...`))
     }
 
+    release()
     clientRefresh()
     toRebuild.clear()
     toRemove.clear()
-    release()
   }
 
   const watcher = chokidar.watch(".", {

--
Gitblit v1.10.0