Skip to content

Commit 282c3f1

Browse files
authored
fix: bump all dependencies and clean up (#30)
1 parent 67aa34f commit 282c3f1

File tree

20 files changed

+683
-768
lines changed

20 files changed

+683
-768
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ node_modules
33

44
# generated content
55
.map.ts
6+
.source
67
.contentlayer
78
api-reference.json
89
content/docs/api-reference/*.mdx

.prettierrc.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
const config = {
66
semi: false,
77
singleQuote: false,
8-
trailingComma: 'none',
8+
trailingComma: "none",
99
printWidth: 100,
10-
endOfLine: 'auto',
11-
// plugins: ['prettier-plugin-tailwindcss']
10+
endOfLine: "auto",
11+
plugins: ["prettier-plugin-tailwindcss"]
1212
}
1313

14-
module.exports = config
14+
export default config

app/(docs)/[[...slug]]/page.tsx

Lines changed: 54 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
import { getPage, getPages } from "@/app/source"
2-
import { DocsPage, DocsBody } from "fumadocs-ui/page"
1+
import { openapi, utils } from "@/app/source"
2+
import { DocsPage, DocsBody, DocsTitle, DocsDescription } from "fumadocs-ui/page"
33
import { notFound } from "next/navigation"
4-
import { RollButton } from "fumadocs-ui/components/roll-button"
5-
import type { Metadata } from "next"
6-
import { join } from "path"
7-
import { getGithubLastEdit } from "fumadocs-core/server"
4+
import defaultComponents from "fumadocs-ui/mdx"
5+
import { Popup, PopupContent, PopupTrigger } from "fumadocs-ui/twoslash/popup"
6+
import { Tab, Tabs } from "fumadocs-ui/components/tabs"
7+
import { Callout } from "fumadocs-ui/components/callout"
8+
import { TypeTable } from "fumadocs-ui/components/type-table"
9+
import { Accordion, Accordions } from "fumadocs-ui/components/accordion"
10+
import ImageSection from "@/app/components/ImageSection"
11+
import type { ComponentProps, FC } from "react"
812

9-
export default async function Page({ params }: { params: { slug?: string[] } }) {
10-
const page = getPage(params.slug)
13+
interface Param {
14+
slug: string[]
15+
}
16+
17+
export default function Page({ params }: { params: Param }): React.ReactElement {
18+
const page = utils.getPage(params.slug)
1119

1220
if (!page) notFound()
1321

@@ -17,7 +25,7 @@ export default async function Page({ params }: { params: { slug?: string[] } })
1725
href={`https://github.com/gitbutlerapp/gitbutler-docs/blob/main/content/docs/${page.file.path}`}
1826
target="_blank"
1927
rel="noreferrer noopener"
20-
className="group rounded-md text-neutral-500 dark:text-neutral-400 dark:bg-neutral-900 border border-neutral-300/50 text-sm py-1 dark:border-neutral-700 flex justify-center items-center gap-2 hover:bg-neutral-100 transition duration-300 dark:hover:bg-neutral-950"
28+
className="group flex items-center justify-center gap-2 rounded-md border border-neutral-300/50 py-1 text-sm text-neutral-500 transition duration-300 hover:bg-neutral-100 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-400 dark:hover:bg-neutral-950"
2129
>
2230
<svg
2331
className="size-4 group-hover:animate-[var(--animation-shake-x)]"
@@ -35,10 +43,10 @@ export default async function Page({ params }: { params: { slug?: string[] } })
3543
href={`https://github.com/gitbutlerapp/gitbutler-docs/issues/new?label=docs&title=Feedback+for+page+"${page.file.flattenedPath}"`}
3644
target="_blank"
3745
rel="noreferrer noopener"
38-
className="rounded-md text-neutral-500 dark:text-neutral-400 dark:bg-neutral-900 border border-neutral-300/50 text-sm py-1 dark:border-neutral-700 flex justify-center items-center gap-2 hover:bg-neutral-100 transition duration-300 dark:hover:bg-neutral-950 group"
46+
className="group flex items-center justify-center gap-2 rounded-md border border-neutral-300/50 py-1 text-sm text-neutral-500 transition duration-300 hover:bg-neutral-100 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-400 dark:hover:bg-neutral-950"
3947
>
4048
<svg
41-
className="size-4 transition ease-[var(--ease-spring-3)] duration-500 group-hover:animate-[var(--animation-bounce)]"
49+
className="size-4 transition duration-500 ease-[var(--ease-spring-3)] group-hover:animate-[var(--animation-bounce)]"
4250
xmlns="http://www.w3.org/2000/svg"
4351
viewBox="0 0 256 256"
4452
>
@@ -65,46 +73,59 @@ export default async function Page({ params }: { params: { slug?: string[] } })
6573
</>
6674
)
6775

68-
const time = await getGithubLastEdit({
69-
owner: "gitbutlerapp",
70-
repo: "gitbutler-docs",
71-
path: join("content/docs/", page.file.path)
72-
})
73-
74-
const MDX = page.data.exports.default
75-
7676
return (
7777
<DocsPage
78-
toc={page.data.exports.toc}
79-
full={page.data.full ?? false}
80-
lastUpdate={time ?? undefined}
78+
toc={page.data.toc}
79+
full={page.data.full}
8180
tableOfContent={{
81+
style: "clerk",
82+
single: false,
83+
footer
84+
}}
85+
lastUpdate={page.data.lastModified}
86+
tableOfContentPopover={{
8287
footer
8388
}}
84-
tableOfContentPopover={{ footer }}
8589
>
86-
<RollButton percentage={0.3} />
90+
<DocsTitle>{page.data.title}</DocsTitle>
91+
<DocsDescription>{page.data.description}</DocsDescription>
8792
<DocsBody>
88-
<h1>{page.data.title}</h1>
89-
<MDX />
93+
<page.data.body
94+
components={{
95+
...defaultComponents,
96+
Popup,
97+
PopupContent,
98+
PopupTrigger,
99+
Tabs,
100+
Tab,
101+
TypeTable,
102+
Accordion,
103+
Accordions,
104+
ImageSection,
105+
blockquote: Callout as unknown as FC<ComponentProps<"blockquote">>,
106+
APIPage: openapi.APIPage
107+
}}
108+
/>
90109
</DocsBody>
91110
</DocsPage>
92111
)
93112
}
94113

95-
export async function generateStaticParams() {
96-
return getPages().map((page) => ({
97-
slug: page.slugs
98-
}))
114+
export function generateStaticParams(): Param[] {
115+
return utils.getPages().map((page) => {
116+
return {
117+
slug: page.slugs
118+
}
119+
})
99120
}
100121

101122
export function generateMetadata({ params }: { params: { slug?: string[] } }) {
102-
const page = getPage(params.slug)
123+
const page = utils.getPage(params.slug)
103124

104-
if (page == null) notFound()
125+
if (!page) notFound()
105126

106127
return {
107128
title: page.data.title,
108129
description: page.data.description
109-
} satisfies Metadata
130+
}
110131
}

app/(docs)/layout.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { DocsLayout } from 'fumadocs-ui/layout';
2-
import type { ReactNode } from 'react';
3-
import { docsOptions } from '../layout.config';
1+
import { DocsLayout } from "fumadocs-ui/layout"
2+
import type { ReactNode } from "react"
3+
import { docsOptions } from "@/app/layout.config"
4+
import "fumadocs-ui/twoslash.css"
45

56
export default function Layout({ children }: { children: ReactNode }) {
6-
return <DocsLayout {...docsOptions}>{children}</DocsLayout>;
7+
return <DocsLayout {...docsOptions}>{children}</DocsLayout>
78
}

app/api/search/route.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { getPages } from '@/app/source';
2-
import { createSearchAPI } from 'fumadocs-core/search/server';
1+
import { utils } from "@/app/source"
2+
import { createSearchAPI } from "fumadocs-core/search/server"
33

4-
export const { GET } = createSearchAPI('advanced', {
5-
indexes: getPages().map((page) => ({
6-
title: page.data.title,
7-
structuredData: page.data.exports.structuredData,
8-
id: page.url,
9-
url: page.url,
10-
})),
11-
});
4+
export const { GET } = createSearchAPI("advanced", {
5+
indexes: utils.getPages().map((page) => {
6+
return {
7+
title: page.data.title,
8+
structuredData: page.data.structuredData,
9+
id: page.url,
10+
url: page.url
11+
}
12+
})
13+
})

app/components/CodeBlock.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

app/layout.config.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { type BaseLayoutProps, type DocsLayoutProps } from "fumadocs-ui/layout"
2-
import { pageTree } from "./source"
1+
import { utils } from "@/app/source"
2+
import type { DocsLayoutProps } from "fumadocs-ui/layout"
3+
import type { HomeLayoutProps } from "fumadocs-ui/home-layout"
4+
35
import Logo from "@/components/Logo"
46
import Discord from "@/components/logos/discord"
57
import GitButler from "@/components/logos/gitbutler-wordmark"
68

79
// shared configuration
8-
export const baseOptions: BaseLayoutProps = {
10+
export const baseOptions: HomeLayoutProps = {
911
nav: {
1012
title: <Logo />,
1113
transparentMode: "top"
@@ -31,5 +33,5 @@ export const docsOptions: DocsLayoutProps = {
3133
sidebar: {
3234
defaultOpenLevel: 0
3335
},
34-
tree: pageTree
36+
tree: utils.pageTree
3537
}

app/sitemap.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { MetadataRoute } from "next"
2-
import { getPages } from "./source"
2+
import { utils } from "./source"
33

44
const baseUrl =
55
process.env.NODE_ENV === "development"
@@ -15,11 +15,9 @@ export default function sitemap(): MetadataRoute.Sitemap {
1515
changeFrequency: "monthly",
1616
priority: 0.8
1717
},
18-
...getPages().map<MetadataRoute.Sitemap[number]>((page) => ({
18+
...utils.getPages().map<MetadataRoute.Sitemap[number]>((page) => ({
1919
url: url(page.url),
20-
lastModified: page.data.exports.lastModified
21-
? new Date(page.data.exports.lastModified)
22-
: undefined,
20+
lastModified: page.data.lastModified ? new Date(page.data.lastModified) : undefined,
2321
changeFrequency: "weekly",
2422
priority: 0.5
2523
}))

app/source.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
import { map } from "@/.map"
1+
import { meta, docs } from "@/.source"
22
import { createMDXSource } from "fumadocs-mdx"
33
import { loader } from "fumadocs-core/source"
4+
import { attachFile, createOpenAPI } from "fumadocs-openapi/server"
5+
import type { InferMetaType, InferPageType } from "fumadocs-core/source"
46

5-
export const { getPage, getPages, pageTree, files } = loader({
6-
baseUrl: "/",
7-
rootDir: "docs",
8-
source: createMDXSource(map)
7+
export const utils = loader({
8+
source: createMDXSource(docs, meta),
9+
pageTree: {
10+
attachFile
11+
}
912
})
13+
14+
export const openapi = createOpenAPI({})
15+
16+
export type Page = InferPageType<typeof utils>
17+
export type Meta = InferMetaType<typeof utils>

content/docs/api-reference/index.mdx

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)