import fs from 'fs' import matter from 'gray-matter' import components from '~/components/index' import { MDXRemote } from 'next-mdx-remote' import { serialize } from 'next-mdx-remote/serialize' import specFile from '~/spec/analytics_v0_config.yaml' assert { type: 'yml' } import { Parameter } from '~/lib/refGenerator/refTypes' import ReactMarkdown from 'react-markdown' // Parameters are grouped on the page by tag const TAGS = ['general', 'database'] export default function Config(props) { return (

{specFile.info.title} Configuration

{specFile.info.description}
{props.docs .filter((doc) => doc.introPage) .map((item) => ( ))}
{TAGS.map((tag) => specFile.parameters .filter((param: Parameter) => param.tags[0] === tag) .map((parameter: Parameter, index) => (
{index === 0 &&

{tag} Settings

}

$ {parameter.title}

{parameter.description}

Required: {parameter.required.toString()}
Default: {parameter.default ? parameter.default.toString() : 'None'}
{parameter.links && parameter.links.map((link) => (

See also:

  • {link.name}
  • ))}
    )) )}
    ) } export async function getServerSideProps() { // an array of ids of the intro sections for this library const introPages = ['analytics'] const pages = [...introPages] // Grab custom markdown intro page files const allMarkdownDocs = await Promise.all( pages.map(async (x: any, i) => { const pathName = `docs/ref/analytics/${x}.mdx` const markdownExists = fs.existsSync(pathName) const fileContents = markdownExists ? fs.readFileSync(pathName, 'utf8') : '' const { data, content } = matter(fileContents) return { id: x, title: x, // ...content, meta: data, introPage: introPages.includes(x), content: content ? await serialize(content || '') : null, } }) ) return { props: { docs: allMarkdownDocs, }, } }