perf(theme): improve auto-frontmatter cache (#222)

This commit is contained in:
pengzhanbo 2024-09-27 08:40:06 +08:00 committed by GitHub
parent 117522969e
commit fe3945ccc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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(