Jacky Zhao
2023-08-03 663c41fa41faad1528335a18c73a197ed5c6ea11
use posix style paths for all path ops
7 files modified
19 ■■■■■ changed files
quartz/bootstrap-cli.mjs 6 ●●●●● patch | view | raw | blame | history
quartz/build.ts 2 ●●● patch | view | raw | blame | history
quartz/plugins/emitters/aliases.ts 2 ●●● patch | view | raw | blame | history
quartz/plugins/emitters/static.ts 3 ●●●● patch | view | raw | blame | history
quartz/plugins/transformers/lastmod.ts 2 ●●● patch | view | raw | blame | history
quartz/plugins/transformers/links.ts 2 ●●● patch | view | raw | blame | history
quartz/processors/parse.ts 2 ●●● patch | view | raw | blame | history
quartz/bootstrap-cli.mjs
@@ -49,12 +49,6 @@
    default: true,
    describe: "push updates to your Quartz fork",
  },
  force: {
    boolean: true,
    alias: ["f"],
    default: true,
    describe: "whether to apply the --force flag to git commands",
  },
  pull: {
    boolean: true,
    default: true,
quartz/build.ts
@@ -99,7 +99,7 @@
          ctx.allSlugs = [...new Set([...contentMap.keys(), ...toRebuild])]
            .filter((fp) => !toRemove.has(fp))
            .map((fp) => slugifyFilePath(path.relative(argv.directory, fp) as FilePath))
            .map((fp) => slugifyFilePath(path.posix.relative(argv.directory, fp) as FilePath))
          const parsedContent = await parseMarkdown(ctx, filesToRebuild)
          for (const content of parsedContent) {
quartz/plugins/emitters/aliases.ts
@@ -18,7 +18,7 @@
    for (const [_tree, file] of content) {
      const ogSlug = canonicalizeServer(file.data.slug!)
      const dir = path.relative(argv.directory, file.dirname ?? argv.directory)
      const dir = path.posix.relative(argv.directory, file.dirname ?? argv.directory)
      let aliases: CanonicalSlug[] = []
      if (file.data.frontmatter?.aliases) {
quartz/plugins/emitters/static.ts
@@ -1,6 +1,5 @@
import { FilePath, QUARTZ, joinSegments } from "../../path"
import { QuartzEmitterPlugin } from "../types"
import path from "path"
import fs from "fs"
import { glob } from "../../glob"
@@ -10,7 +9,7 @@
    return []
  },
  async emit({ argv, cfg }, _content, _resources, _emit): Promise<FilePath[]> {
    const staticPath = path.join(QUARTZ, "static")
    const staticPath = joinSegments(QUARTZ, "static")
    const fps = await glob("**", staticPath, cfg.configuration.ignorePatterns)
    await fs.promises.cp(staticPath, joinSegments(argv.output, "static"), { recursive: true })
    return fps.map((fp) => joinSegments("static", fp)) as FilePath[]
quartz/plugins/transformers/lastmod.ts
@@ -27,7 +27,7 @@
            let modified: MaybeDate = undefined
            let published: MaybeDate = undefined
            const fp = path.join(file.cwd, file.data.filePath as string)
            const fp = path.posix.join(file.cwd, file.data.filePath as string)
            for (const source of opts.priority) {
              if (source === "filesystem") {
                const st = await fs.promises.stat(fp)
quartz/plugins/transformers/links.ts
@@ -76,7 +76,7 @@
                // don't process external links or intra-document anchors
                if (!(isAbsoluteUrl(dest) || dest.startsWith("#"))) {
                  dest = node.properties.href = transformLink(dest)
                  const canonicalDest = path.normalize(joinSegments(curSlug, dest))
                  const canonicalDest = path.posix.normalize(joinSegments(curSlug, dest))
                  const [destCanonical, _destAnchor] = splitAnchor(canonicalDest)
                  outgoing.add(destCanonical as CanonicalSlug)
                }
quartz/processors/parse.ts
@@ -91,7 +91,7 @@
        }
        // base data properties that plugins may use
        file.data.slug = slugifyFilePath(path.relative(argv.directory, file.path) as FilePath)
        file.data.slug = slugifyFilePath(path.posix.relative(argv.directory, file.path) as FilePath)
        file.data.filePath = fp
        const ast = processor.parse(file)