Jacky Zhao
2025-03-13 d9159e0ac9bfc22e584c78bc8aa04ecd82c14eea
quartz/plugins/emitters/cname.ts
@@ -2,6 +2,7 @@
import { QuartzEmitterPlugin } from "../types"
import fs from "fs"
import chalk from "chalk"
import DepGraph from "../../depgraph"
export function extractDomainFromBaseUrl(baseUrl: string) {
  const url = new URL(`https://${baseUrl}`)
@@ -10,10 +11,10 @@
export const CNAME: QuartzEmitterPlugin = () => ({
  name: "CNAME",
  getQuartzComponents() {
    return []
  async getDependencyGraph(_ctx, _content, _resources) {
    return new DepGraph<FilePath>()
  },
  async emit({ argv, cfg }, _content, _resources, _emit): Promise<FilePath[]> {
  async emit({ argv, cfg }, _content, _resources) {
    if (!cfg.configuration.baseUrl) {
      console.warn(chalk.yellow("CNAME emitter requires `baseUrl` to be set in your configuration"))
      return []
@@ -23,7 +24,7 @@
    if (!content) {
      return []
    }
    fs.writeFileSync(path, content)
    await fs.promises.writeFile(path, content)
    return [path] as FilePath[]
  },
})