You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Stats}from'fs'import{readFile,writeFile}from'fs/promises'import{join}from'path'importreaddirpfrom'readdirp'import{DATA_DIR,NEXT_PUBLIC_NOTE_DIR}from'@zkp/paths'import{slugify}from'@zkp/slugify'// TODO: Make the dataBy... files inherit from the same functionexportconstmdxDataByName=async()=>{constdatapath=join(DATA_DIR,'dataByName.json')try{constdata=JSON.parse(awaitreadFile(datapath,'utf8'))returndata}catch(e){constdata=(awaitreaddirp.promise(NEXT_PUBLIC_NOTE_DIR,{alwaysStat: true}))// Only include md(x) files.filter((entry)=>/\.mdx?$/.test(entry.path)).reduce((acc,curr)=>{constname=curr.basename.replace(/\.mdx?$/,'').toLowerCase()acc[name]={stats: curr.stats!,fullPath: curr.fullPath,path: curr.path,
name,slug: slugify(name),folders: curr.basename.split('/')??[],basename: curr.basename,}returnacc},{}as{[name: string]: {basename: stringstats: StatsfullPath: stringname: stringfolders: string[]path: stringslug: string}},)awaitwriteFile(datapath,JSON.stringify(data))returndata}}
208e02d67253ff2d0f900673df873f9ad1fde34d
The text was updated successfully, but these errors were encountered:
Make the dataBy... files inherit from the same function
https://github.com/JournalOfTrialAndError/centeroftrialanderror.com/blob/1c2a62be7e2ccb916db6dfb0a5f0c2701cee1fef/libs/utils/mdx/src/lib/mdxDataByName.ts#L8
208e02d67253ff2d0f900673df873f9ad1fde34d
The text was updated successfully, but these errors were encountered: