From 951d1dec24eb8e0bea4ec548cc79c5ce718bf02f Mon Sep 17 00:00:00 2001
From: fl0werpowers <47599466+fl0werpowers@users.noreply.github.com>
Date: Wed, 28 May 2025 08:40:51 +0000
Subject: [PATCH] chore(deps): replace `chalk` and `rimraf` with builtin functions (#1879)

---
 quartz/plugins/emitters/cname.ts |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/quartz/plugins/emitters/cname.ts b/quartz/plugins/emitters/cname.ts
new file mode 100644
index 0000000..0209d9a
--- /dev/null
+++ b/quartz/plugins/emitters/cname.ts
@@ -0,0 +1,29 @@
+import { FilePath, joinSegments } from "../../util/path"
+import { QuartzEmitterPlugin } from "../types"
+import fs from "fs"
+import { styleText } from "util"
+
+export function extractDomainFromBaseUrl(baseUrl: string) {
+  const url = new URL(`https://${baseUrl}`)
+  return url.hostname
+}
+
+export const CNAME: QuartzEmitterPlugin = () => ({
+  name: "CNAME",
+  async emit({ argv, cfg }) {
+    if (!cfg.configuration.baseUrl) {
+      console.warn(
+        styleText("yellow", "CNAME emitter requires `baseUrl` to be set in your configuration"),
+      )
+      return []
+    }
+    const path = joinSegments(argv.output, "CNAME")
+    const content = extractDomainFromBaseUrl(cfg.configuration.baseUrl)
+    if (!content) {
+      return []
+    }
+    await fs.promises.writeFile(path, content)
+    return [path] as FilePath[]
+  },
+  async *partialEmit() {},
+})

--
Gitblit v1.10.0