feat: update content
This commit is contained in:
parent
5a98111911
commit
6bb8c947a3
44 changed files with 696 additions and 268 deletions
|
|
@ -4,10 +4,10 @@ import matter from 'gray-matter'
|
|||
import { remark } from 'remark'
|
||||
import html from 'remark-html'
|
||||
|
||||
const docsDirectory = path.join(process.cwd(), 'research/docs')
|
||||
const root = path.join(process.cwd(), 'research')
|
||||
|
||||
export async function getDoc(id: string) {
|
||||
const fullPath = path.join(docsDirectory, `${id}.md`)
|
||||
export async function getArtifact(dir: string, id: string) {
|
||||
const fullPath = path.join(root, dir, `${id}.md`)
|
||||
|
||||
// read file contents
|
||||
const fileContents = fs.readFileSync(fullPath, 'utf8')
|
||||
|
|
@ -2,14 +2,19 @@ import fs from 'fs'
|
|||
import path from 'path'
|
||||
import matter from 'gray-matter'
|
||||
|
||||
const docsDirectory = path.join(process.cwd(), 'research/docs')
|
||||
const root = path.join(process.cwd(), 'research')
|
||||
|
||||
export const getDocs = () => {
|
||||
const fileNames = fs.readdirSync(docsDirectory)
|
||||
return fileNames.map((fileName) => {
|
||||
// set id and full path
|
||||
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$/, '')
|
||||
const fullPath = path.join(docsDirectory, fileName)
|
||||
|
||||
// set full path
|
||||
const fullPath = path.join(root, dir, fileName)
|
||||
|
||||
// read file contents
|
||||
const fileContents = fs.readFileSync(fullPath, 'utf8')
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
export { getDoc } from './getDoc'
|
||||
export { getDocs } from './getDocs'
|
||||
export { getArtifact } from './getArtifact'
|
||||
export { getArtifacts } from './getArtifacts'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue