Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation site #24

Merged
merged 17 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .map.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** Auto-generated */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generated at build time. It essentially creates a 'map', as per the file name, of all the docs pages so that they can be looped through by the loader and rendered.

declare const map: Record<string, unknown>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do all these files have to be in the root dir?

Am a big fan of a clean root dir.


export { map }
29 changes: 29 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { MDXComponents } from 'mdx/types'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are MDX components. MDX is essentially markdown supercharged with JSX, allowing us to use React components in our docs.

import defaultComponents from 'fumadocs-ui/mdx'
import type { ReactNode } from 'react'
import { Tab, Tabs } from 'fumadocs-ui/components/tabs'
import { Step, Steps } from 'fumadocs-ui/components/steps'
import { Callout } from 'fumadocs-ui/components/callout'

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...defaultComponents,
...components,
Tab,
Tabs,
InstallTabs: ({
items,
children,
}: {
items: string[]
children: ReactNode
}) => (
<Tabs items={items} id="package-manager">
{children}
</Tabs>
),
Step,
Steps,
Callout,
}
}
14 changes: 13 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially useful
* for Docker builds.
*/
import createMDX from 'fumadocs-mdx/config'
import { fileGenerator, remarkDocGen, remarkInstall } from 'fumadocs-docgen'

await import('./src/env.js')

const withMDX = createMDX({
rootContentPath: './src/content',
mdxOptions: {
lastModifiedTime: 'git',
remarkPlugins: [[remarkInstall, { Tabs: 'InstallTabs' }], [remarkDocGen, { generators: [fileGenerator()] }]],
},
})

/** @type {import("next").NextConfig} */
const config = {
reactStrictMode: true,
output: 'standalone',
}

export default config
export default withMDX(config)
11 changes: 11 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "hackathon",
"type": "module",
"version": "0.1.0",
"repository": {
"type": "git",
"url": "https://github.com/cuhacking/hackathon.git"
},
"private": true,
"scripts": {
"build": "next build",
Expand All @@ -26,7 +30,13 @@
"@trpc/client": "next",
"@trpc/react-query": "next",
"@trpc/server": "next",
"@types/mdx": "^2.0.13",
"fumadocs-core": "^13.0.4",
"fumadocs-docgen": "^1.1.0",
"fumadocs-mdx": "^9.0.0",
"fumadocs-ui": "^13.0.4",
"geist": "^1.3.0",
"lucide-react": "^0.424.0",
"next": "^14.2.1",
"next-auth": "^4.24.7",
"playwright": "^1.45.2",
Expand All @@ -46,6 +56,7 @@
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-config-next": "^14.1.3",
"eslint-plugin-format": "^0.1.2",
Expand Down
Loading