Skip to content

Commit 09a553b

Browse files
committed
chore: use async glob from fs.promises in blog.ts
1 parent f42de14 commit 09a553b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/blog.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {
1515
} from '../shared/schemas/blog'
1616
import { isProduction } from '../config/env'
1717
import { BLUESKY_API } from '../shared/utils/constants'
18-
import { mkdir, writeFile } from 'node:fs/promises'
19-
import { existsSync, globSync } from 'node:fs'
18+
import { glob, mkdir, writeFile } from 'node:fs/promises'
19+
import { existsSync } from 'node:fs'
2020
import crypto from 'node:crypto'
2121

2222
/**
@@ -88,7 +88,9 @@ function resolveAuthors(authors: Author[], avatarMap: Map<string, string>): Reso
8888
* Resolves Bluesky avatars at build time.
8989
*/
9090
async function loadBlogPosts(blogDir: string, imagesDir: string): Promise<BlogPostFrontmatter[]> {
91-
const files = globSync('*.md', { cwd: blogDir }).map(file => join(blogDir, file))
91+
const files = (await Array.fromAsync(glob('*.md', { cwd: blogDir }))).map(file =>
92+
join(blogDir, file),
93+
)
9294

9395
// First pass: extract raw frontmatter and collect all Bluesky handles
9496
const rawPosts: Array<{ frontmatter: Record<string, unknown> }> = []

0 commit comments

Comments
 (0)