feat: update content

This commit is contained in:
ryanchristo 2026-11-15 20:31:14 -08:00
parent 5a98111911
commit 6bb8c947a3
No known key found for this signature in database
44 changed files with 696 additions and 268 deletions

31
utils/getArtifacts.ts Normal file
View file

@ -0,0 +1,31 @@
import fs from 'fs'
import path from 'path'
import matter from 'gray-matter'
const root = path.join(process.cwd(), 'research')
export const getArtifacts = (dir: string) => {
const fileNames = fs.readdirSync(root + '/' + dir)
const filtered = fileNames.filter((fileName) => fileName.includes(`.md`))
return filtered.map((fileName) => {
// set id
const id = fileName.replace(/\.md$/, '')
// set full path
const fullPath = path.join(root, dir, fileName)
// read file contents
const fileContents = fs.readFileSync(fullPath, 'utf8')
// parse file contents
const { data } = matter(fileContents)
// return id and data
return {
id,
...data,
}
}) as any[]
}