Skip to content

Commit 15986b6

Browse files
committed
chore: replace tinyglobby with Node.js built-in glob APIs
1 parent d3f60cb commit 15986b6

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

modules/blog.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ import {
1313
type BlogPostFrontmatter,
1414
type ResolvedAuthor,
1515
} from '../shared/schemas/blog'
16-
import { globSync } from 'tinyglobby'
1716
import { isProduction } from '../config/env'
1817
import { BLUESKY_API } from '../shared/utils/constants'
1918
import { mkdir, writeFile } from 'node:fs/promises'
20-
import { existsSync } from 'node:fs'
19+
import { existsSync, globSync } from 'node:fs'
2120
import crypto from 'node:crypto'
2221

2322
/**
@@ -89,7 +88,7 @@ function resolveAuthors(authors: Author[], avatarMap: Map<string, string>): Reso
8988
* Resolves Bluesky avatars at build time.
9089
*/
9190
async function loadBlogPosts(blogDir: string, imagesDir: string): Promise<BlogPostFrontmatter[]> {
92-
const files: string[] = globSync(join(blogDir, '*.md').replace(/\\/g, '/'))
91+
const files = globSync('*.md', { cwd: blogDir }).map(file => join(blogDir, file))
9392

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

modules/standard-site-sync.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import process from 'node:process'
22
import { createHash } from 'node:crypto'
3+
import { glob } from 'node:fs/promises'
4+
import { join } from 'node:path'
35
import { defineNuxtModule, useNuxt, createResolver } from 'nuxt/kit'
46
import { safeParse } from 'valibot'
57
import { BlogPostSchema, type BlogPostFrontmatter } from '#shared/schemas/blog'
@@ -51,8 +53,9 @@ export default defineNuxtModule({
5153
const possiblePublication = await checkPublication(handle, pdsPublicClient)
5254

5355
nuxt.hook('build:before', async () => {
54-
const { glob } = await import('tinyglobby')
55-
const files: string[] = await glob(`${contentDir}/**/*.md`)
56+
const files = (await Array.fromAsync(glob('**/*.md', { cwd: contentDir }))).map(file =>
57+
join(contentDir, file),
58+
)
5659

5760
// INFO: Arbitrarily chosen concurrency limit, can be changed if needed
5861
const concurrencyLimit = 5

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
"simple-git": "3.33.0",
100100
"spdx-license-list": "6.11.0",
101101
"std-env": "4.0.0",
102-
"tinyglobby": "0.2.15",
103102
"ufo": "1.6.3",
104103
"unocss": "66.6.7",
105104
"unplugin-vue-router": "0.19.2",

pnpm-lock.yaml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)