feat: update content
This commit is contained in:
parent
5a98111911
commit
6bb8c947a3
44 changed files with 696 additions and 268 deletions
|
|
@ -1,26 +0,0 @@
|
|||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import matter from 'gray-matter'
|
||||
|
||||
const docsDirectory = path.join(process.cwd(), 'research/docs')
|
||||
|
||||
export const getDocs = () => {
|
||||
const fileNames = fs.readdirSync(docsDirectory)
|
||||
return fileNames.map((fileName) => {
|
||||
// set id and full path
|
||||
const id = fileName.replace(/\.md$/, '')
|
||||
const fullPath = path.join(docsDirectory, 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[]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue