File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 1- import { FilePath , joinSegments } from "../../util/path"
21import { QuartzEmitterPlugin } from "../types"
3- import fs from "fs "
2+ import { write } from "./helpers "
43import { styleText } from "util"
4+ import { FullSlug } from "../../util/path"
55
66export function extractDomainFromBaseUrl ( baseUrl : string ) {
77 const url = new URL ( `https://${ baseUrl } ` )
@@ -10,20 +10,25 @@ export function extractDomainFromBaseUrl(baseUrl: string) {
1010
1111export const CNAME : QuartzEmitterPlugin = ( ) => ( {
1212 name : "CNAME" ,
13- async emit ( { argv , cfg } ) {
14- if ( ! cfg . configuration . baseUrl ) {
13+ async emit ( ctx ) {
14+ if ( ! ctx . cfg . configuration . baseUrl ) {
1515 console . warn (
1616 styleText ( "yellow" , "CNAME emitter requires `baseUrl` to be set in your configuration" ) ,
1717 )
1818 return [ ]
1919 }
20- const path = joinSegments ( argv . output , "CNAME" )
21- const content = extractDomainFromBaseUrl ( cfg . configuration . baseUrl )
20+ const content = extractDomainFromBaseUrl ( ctx . cfg . configuration . baseUrl )
2221 if ( ! content ) {
2322 return [ ]
2423 }
25- await fs . promises . writeFile ( path , content )
26- return [ path ] as FilePath [ ]
24+
25+ const path = await write ( {
26+ ctx,
27+ content,
28+ slug : "CNAME" as FullSlug ,
29+ ext : "" ,
30+ } )
31+ return [ path ]
2732 } ,
2833 async * partialEmit ( ) { } ,
2934} )
You can’t perform that action at this time.
0 commit comments