Skip to content

Commit

Permalink
perf(theme): improve auto-frontmatter cache (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo authored Sep 27, 2024
1 parent 1175229 commit fe3945c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion theme/src/node/autoFrontmatter/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ export async function generateAutoFrontmatter(app: App) {

const cachePath = app.dir.cache(CACHE_FILE)
if (fs.existsSync(cachePath)) {
generate.cache = JSON.parse(await fs.readFile(cachePath, 'utf-8'))
try {
generate.cache = JSON.parse(await fs.readFile(cachePath, 'utf-8'))
}
catch {
generate.cache = {}
}
}
const markdownList = await readMarkdownList(app, generate)
await promiseParallel(
Expand Down

0 comments on commit fe3945c

Please sign in to comment.