Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
76 changes: 76 additions & 0 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Deploy Fumadocs wiki to Pages

on:
push:
branches: [main, wiki]
paths:
- "wiki/**"
- ".github/workflows/wiki.yml"

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: wiki
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 12.21.0

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: wiki/pnpm-lock.yaml

- name: Setup Pages
id: pages
uses: actions/configure-pages@v6

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build wiki
env:
NODE_ENV: production
NEXT_PUBLIC_BASE_PATH: ${{ steps.pages.outputs.base_path }}
NEXT_PUBLIC_SITE_URL: ${{ steps.pages.outputs.base_url }}/
run: pnpm build

- name: Disable Jekyll processing
run: touch out/.nojekyll

- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: wiki/out
include-hidden-files: true

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
26 changes: 26 additions & 0 deletions wiki/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# deps
/node_modules

# generated content
.source

# test & build
/coverage
/.next/
/out/
/build
*.tsbuildinfo

# misc
.DS_Store
*.pem
/.pnp
.pnp.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# others
.env*.local
.vercel
next-env.d.ts
20 changes: 20 additions & 0 deletions wiki/AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Fumadocs

This site is built with [Fumadocs](https://fumadocs.dev) on Next.js. The APIs and conventions of Fumadocs may differ from your training data, so check its docs for the task at hand:

- Writing pages: https://fumadocs.dev/docs/next/markdown.md
- Organizing pages and folders: https://fumadocs.dev/docs/next/page-conventions.md
- Customizing the UI: https://fumadocs.dev/docs/next/guides/customize-ui.md
- Changing the theme and colors: https://fumadocs.dev/docs/ui/theme.md
- Upgrading Fumadocs: https://fumadocs.dev/docs/next/upgrade.md
- Other tasks: https://fumadocs.dev/llms.txt lists every docs page.

<!-- BEGIN:nextjs-agent-rules -->

## This is NOT the Next.js you know

This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.

This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.

<!-- END:nextjs-agent-rules -->
28 changes: 28 additions & 0 deletions wiki/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# PyralOS Wiki

The PyralOS Wiki is built with [Fumadocs](https://fumadocs.dev) on Next.js.

## Development

```bash
pnpm install
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) for the landing page, or
[http://localhost:3000/docs](http://localhost:3000/docs) for the documentation.

| Command | Action |
| ------------------ | --------------------------------------------- |
| `pnpm dev` | Start the development server on port 3000 |
| `pnpm build` | Export the static site to `out/` |
| `pnpm start` | Serve the exported site locally |
| `pnpm types:check` | Generate Next.js types and type-check the app |

`next.config.mjs` reads `NEXT_PUBLIC_BASE_PATH` for the GitHub Pages subpath and
`NEXT_PUBLIC_SITE_URL` for absolute metadata URLs; the deployment workflow sets
both. For a local preview of the exported site, build without these variables.

## Writing docs

Pages live in `content/docs` as `.md` or `.mdx` files.
6 changes: 6 additions & 0 deletions wiki/app/(home)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { HomeLayout } from 'fumadocs-ui/layouts/home';
import { baseOptions } from '@/lib/layout.shared';

export default function Layout({ children }: LayoutProps<'/'>) {
return <HomeLayout {...baseOptions()}>{children}</HomeLayout>;
}
26 changes: 26 additions & 0 deletions wiki/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Link from 'next/link';
import { buttonVariants } from 'fumadocs-ui/components/ui/button';
import { cn } from '@/lib/cn';

export default function HomePage() {
return (
<main className="flex flex-1 flex-col items-center justify-center px-6 py-24 text-center">
<h1 className="text-4xl font-bold tracking-tight sm:text-5xl">PyralOS Wiki</h1>
<p className="mt-4 max-w-xl text-lg text-fd-muted-foreground">
The up-and-coming mobile Linux OS
</p>
<div className="mt-8 flex flex-wrap justify-center gap-3">
<Link
href="/docs/other/learn-more"
className={cn(buttonVariants({ variant: 'primary' }), 'px-4 py-2.5')}>
Learn more about the project
</Link>
<Link
href="/docs/introduction"
className={cn(buttonVariants({ variant: 'outline' }), 'px-4 py-2.5')}>
Read the introduction
</Link>
</div>
</main>
);
}
8 changes: 8 additions & 0 deletions wiki/app/api/search/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { source } from '@/lib/source';
import { createFromSource } from 'fumadocs-core/search/server';

export const revalidate = false;

export const { staticGET: GET } = createFromSource(source, {
language: 'english',
});
63 changes: 63 additions & 0 deletions wiki/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { source } from '@/lib/source';
import {
DocsBody,
DocsDescription,
DocsPage,
DocsTitle,
MarkdownCopyButton,
ViewOptionsPopover,
} from 'fumadocs-ui/layouts/docs/page';
import { notFound } from 'next/navigation';
import { getMDXComponents } from '@/components/mdx';
import type { Metadata } from 'next';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { basePath, getPageImageUrl, gitConfig } from '@/lib/shared';

export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
const params = await props.params;
const page = source.getPage(params.slug);
if (!page) notFound();

const MDX = page.data.body;
const markdownUrl = `${basePath}/llms.mdx${page.url}.md`;

return (
<DocsPage toc={page.data.toc} full={page.data.full}>
<DocsTitle>{page.data.title}</DocsTitle>
<DocsDescription className="mb-0">{page.data.description}</DocsDescription>
<div className="flex flex-row gap-2 items-center border-b pb-6">
<MarkdownCopyButton markdownUrl={markdownUrl} />
<ViewOptionsPopover
markdownUrl={markdownUrl}
githubUrl={`https://github.com/${gitConfig.user}/${gitConfig.repo}/blob/${gitConfig.branch}/content/docs/${encodeURI(page.path)}`}
/>
</div>
<DocsBody>
<MDX
components={getMDXComponents({
// this allows you to link to other pages with relative file paths
a: createRelativeLink(source, page),
})}
/>
</DocsBody>
</DocsPage>
);
}

export async function generateStaticParams() {
return source.generateParams();
}

export async function generateMetadata(props: PageProps<'/docs/[[...slug]]'>): Promise<Metadata> {
const params = await props.params;
const page = source.getPage(params.slug);
if (!page) notFound();

return {
title: page.data.title,
description: page.data.description,
openGraph: {
images: getPageImageUrl(page).url,
},
};
}
11 changes: 11 additions & 0 deletions wiki/app/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { source } from '@/lib/source';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
import { baseOptions } from '@/lib/layout.shared';

export default function Layout({ children }: LayoutProps<'/docs'>) {
return (
<DocsLayout tree={source.getPageTree()} {...baseOptions()}>
{children}
</DocsLayout>
);
}
13 changes: 13 additions & 0 deletions wiki/app/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@import 'tailwindcss';
@import 'fumadocs-ui/css/neutral.css';
@import 'fumadocs-ui/css/preset.css';

html {
scrollbar-gutter: stable;
font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html > body[data-scroll-locked] {
margin-right: 0px !important;
--removed-body-scroll-bar-size: 0px !important;
}
1 change: 1 addition & 0 deletions wiki/app/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions wiki/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Provider } from '@/components/provider';
import type { Metadata } from 'next';
import type { ReactNode } from 'react';
import './global.css';

export const metadata: Metadata = {
metadataBase: new URL(process.env.NEXT_PUBLIC_SITE_URL ?? 'http://localhost:3000'),
title: {
default: 'PyralOS Wiki',
template: '%s | PyralOS Wiki',
},
description: 'Documentation for PyralOS, the up-and-coming mobile Linux OS.',
};

export default function Layout({ children }: { children: ReactNode }) {
return (
<html lang="en" suppressHydrationWarning>
<body className="flex min-h-screen flex-col">
<Provider>{children}</Provider>
</body>
</html>
);
}
7 changes: 7 additions & 0 deletions wiki/app/llms-full.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { docsLlms } from '@/lib/source';

export const revalidate = false;

export async function GET() {
return (await docsLlms.serve('/llms-full.txt'))!;
}
20 changes: 20 additions & 0 deletions wiki/app/llms.mdx/[...path]/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { docsLlms } from '@/lib/source';

export const revalidate = false;
// other paths are 404s, never cached responses
export const dynamicParams = false;

export async function GET(_req: Request, { params }: RouteContext<'/llms.mdx/[...path]'>) {
const { path } = await params;
return (await docsLlms.serve(`/${path.join('/')}`)) ?? new Response(null, { status: 404 });
}

export async function generateStaticParams() {
const params: { path: string[] }[] = [];
for (const file of await docsLlms.files()) {
// `/llms.txt` and `/llms-full.txt` have their own routes
if (!/^\/llms(-full)?\.txt$/.test(file))
params.push({ path: decodeURI(file).slice(1).split('/') });
}
return params;
}
7 changes: 7 additions & 0 deletions wiki/app/llms.txt/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { docsLlms } from '@/lib/source';

export const revalidate = false;

export async function GET() {
return (await docsLlms.serve('/llms.txt'))!;
}
25 changes: 25 additions & 0 deletions wiki/app/og/docs/[...slug]/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { source } from '@/lib/source';
import { notFound } from 'next/navigation';
import { generateOGImage } from 'fumadocs-ui/og';
import { appName, getPageImageUrl } from '@/lib/shared';

export const revalidate = false;

export async function GET(_req: Request, { params }: RouteContext<'/og/docs/[...slug]'>) {
const { slug } = await params;
const page = source.getPage(slug.slice(0, -1));
if (!page) notFound();

return generateOGImage({
title: page.data.title,
description: page.data.description,
site: appName,
});
}

export function generateStaticParams() {
return source.getPages().map((page) => ({
lang: page.locale,
slug: getPageImageUrl(page).segments,
}));
}
15 changes: 15 additions & 0 deletions wiki/components/mdx.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import defaultMdxComponents from 'fumadocs-ui/mdx';
import type { MDXComponents } from 'mdx/types';

export function getMDXComponents(components?: MDXComponents) {
return {
...defaultMdxComponents,
...components,
} satisfies MDXComponents;
}

export const useMDXComponents = getMDXComponents;

declare global {
type MDXProvidedComponents = ReturnType<typeof getMDXComponents>;
}
Loading
Loading