make path and globbing more platform invariant

This commit is contained in:
Jacky Zhao
2023-08-02 22:10:13 -07:00
parent 264ea3d544
commit d7842e0ce7
7 changed files with 45 additions and 54 deletions

View File

@ -4,7 +4,7 @@ import { PerfTimer } from "../perf"
import { getStaticResourcesFromPlugins } from "../plugins"
import { EmitCallback } from "../plugins/types"
import { ProcessedContent } from "../plugins/vfile"
import { FilePath } from "../path"
import { FilePath, joinSegments } from "../path"
import { QuartzLogger } from "../log"
import { trace } from "../trace"
import { BuildCtx } from "../ctx"
@ -16,7 +16,7 @@ export async function emitContent(ctx: BuildCtx, content: ProcessedContent[]) {
log.start(`Emitting output files`)
const emit: EmitCallback = async ({ slug, ext, content }) => {
const pathToPage = path.join(argv.output, slug + ext) as FilePath
const pathToPage = joinSegments(argv.output, slug + ext) as FilePath
const dir = path.dirname(pathToPage)
await fs.promises.mkdir(dir, { recursive: true })
await fs.promises.writeFile(pathToPage, content)