Skip to content

Commit 282c3f1

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

20 files changed

+683
-768
lines changed

.gitignore

+1
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

+4-4
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

+54-33
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

+5-4
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

+12-10
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

-49
This file was deleted.

app/layout.config.tsx

+6-4
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

+3-5
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

+13-5
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

-5
This file was deleted.

content/docs/development/debugging.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you get stuck or need help with anything, hit us up over on Discord, here's [
1414

1515
Often the most helpful thing is to look at the logs. GitButler is a Tauri app, so the logs are in your OS's [app log directory](https://docs.rs/tauri/latest/tauri/api/path/fn.app_log_dir.html). This should be:
1616

17-
<Tabs items={['macOS', 'Windows', 'Linux']}>
17+
<Tabs groupId="platform" items={['macOS', 'Windows', 'Linux']} persist>
1818
<Tab value="macOS">
1919
```bash
2020
~/Library/Logs/com.gitbutler.app/
@@ -68,7 +68,7 @@ In this directory, there should be rolling daily logs:
6868

6969
GitButler also keeps it's own data about each of your projects. The virtual branch metadata, your user config stuff, a log of changes in each file, etc. If you want to inspect what GitButler is doing or debug or reset everything, you can go to our data directory.
7070

71-
<Tabs items={['macOS', 'Windows', 'Linux']}>
71+
<Tabs groupId="platform" items={['macOS', 'Windows', 'Linux']} persist>
7272
<Tab value="macOS">
7373
```bash
7474
~/Library/Application Support/com.gitbutler.app/

content/docs/features/virtual-branches/signing-commits.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ There are lots of other ways to set up GPG or SSH commit signing:
7878
<Callout title="Using GitButler's Generated SSH Key">
7979
Earlier versions of GitButler would only sign with it's generated SSH key. Although we've removed that functionality, you can easily set it back up by pointing the signingKey at the generated SSH Key. The key is located in the following locations:
8080

81-
<Tabs items={['macOS', 'Windows', 'Linux']}>
81+
<Tabs groupId="platform" items={['macOS', 'Windows', 'Linux']} persist>
8282
<Tab value="macOS">
8383
```bash
8484
/Users/[username]/Library/Application Support/com.gitbutler.app/keys/ed25519.pub

eslint.config.mjs renamed to eslint.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import prettier from "eslint-plugin-prettier"
2+
import next from "@next/eslint-plugin-next"
23
import typescriptEslint from "@typescript-eslint/eslint-plugin"
34
import globals from "globals"
45
import tsParser from "@typescript-eslint/parser"
@@ -18,13 +19,13 @@ const compat = new FlatCompat({
1819
const config = [
1920
...compat.extends(
2021
"eslint:recommended",
21-
"next",
2222
"plugin:@typescript-eslint/eslint-recommended",
2323
"plugin:@typescript-eslint/recommended"
2424
),
2525
{
2626
plugins: {
2727
prettier,
28+
next,
2829
"@typescript-eslint": typescriptEslint
2930
},
3031

mdx-components.tsx

-11
This file was deleted.

0 commit comments

Comments
 (0)