feat: make og images an emitter to properly await image generation (#1826)
* checkpoint * make emitters async generators * fix * custom font spec * replace spinner, use disk cache for fonts * use readline instead * make og images look nice
This commit is contained in:
		@@ -33,10 +33,9 @@ export const Assets: QuartzEmitterPlugin = () => {
 | 
			
		||||
 | 
			
		||||
      return graph
 | 
			
		||||
    },
 | 
			
		||||
    async emit({ argv, cfg }, _content, _resources): Promise<FilePath[]> {
 | 
			
		||||
    async *emit({ argv, cfg }, _content, _resources) {
 | 
			
		||||
      const assetsPath = argv.output
 | 
			
		||||
      const fps = await filesToCopy(argv, cfg)
 | 
			
		||||
      const res: FilePath[] = []
 | 
			
		||||
      for (const fp of fps) {
 | 
			
		||||
        const ext = path.extname(fp)
 | 
			
		||||
        const src = joinSegments(argv.directory, fp) as FilePath
 | 
			
		||||
@@ -46,10 +45,8 @@ export const Assets: QuartzEmitterPlugin = () => {
 | 
			
		||||
        const dir = path.dirname(dest) as FilePath
 | 
			
		||||
        await fs.promises.mkdir(dir, { recursive: true }) // ensure dir exists
 | 
			
		||||
        await fs.promises.copyFile(src, dest)
 | 
			
		||||
        res.push(dest)
 | 
			
		||||
        yield dest
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      return res
 | 
			
		||||
    },
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user