update to nextra 4

This commit is contained in:
2025-09-06 19:19:45 +02:00
parent d17a565130
commit 7864c38371
48 changed files with 998 additions and 500 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,3 @@
node_modules
.next
out
public

1
.nvmrc
View File

@@ -1 +0,0 @@
v22.14.0

View File

@@ -0,0 +1,27 @@
import { generateStaticParamsFor, importPage } from "nextra/pages";
import { useMDXComponents as getMDXComponents } from "../../mdx-components";
export const generateStaticParams = generateStaticParamsFor("mdxPath");
export async function generateMetadata(props) {
const params = await props.params;
const { metadata } = await importPage(params.mdxPath);
return metadata;
}
const Wrapper = getMDXComponents().wrapper;
export default async function Page(props) {
const params = await props.params;
const {
default: MDXContent,
toc,
metadata,
sourceCode,
} = await importPage(params.mdxPath);
return (
<Wrapper toc={toc} metadata={metadata} sourceCode={sourceCode}>
<MDXContent {...props} params={params} />
</Wrapper>
);
}

59
app/layout.tsx Normal file
View File

@@ -0,0 +1,59 @@
import { Footer, Layout, Navbar } from "nextra-theme-docs";
import { Banner, Head } from "nextra/components";
import { getPageMap } from "nextra/page-map";
import "nextra-theme-docs/style.css";
export const metadata = {
// Define your metadata here
// For more information on metadata API, see: https://nextjs.org/docs/app/building-your-application/optimizing/metadata
};
const banner = <Banner storageKey="some-key">Nextra 4.0 is released 🎉</Banner>;
const navbar = (
<Navbar
projectLink="https://github.com/cupcakearmy/memoir"
logo={<b>Memoir</b>}
/>
);
const footer = (
<Footer>
<span>
MIT {new Date().getFullYear()} ©{" "}
<a href="https://github.com/cupcakearmy" target="_blank">
cupcakearmy
</a>
.
</span>
</Footer>
);
export default async function RootLayout({ children }) {
return (
<html lang="en" dir="ltr" suppressHydrationWarning>
<Head>
<script
defer
src="https://spectare.nicco.io//unicorn.js"
data-website-id="4aecaa6f-1e68-4a21-960a-8ff5aaa6599a"
></script>
</Head>
<body>
<Layout
sidebar={{
defaultMenuCollapseLevel: 1,
}}
feedback={{
content: "Question? An error? Give feedback →",
}}
banner={banner}
navbar={navbar}
pageMap={await getPageMap()}
docsRepositoryBase="https://github.com/cupcakearmy/memoir/blob/main"
footer={footer}
>
{children}
</Layout>
</body>
</html>
);
}

12
mdx-components.ts Normal file
View File

@@ -0,0 +1,12 @@
import { useMDXComponents as getThemeComponents } from "nextra-theme-docs"; // nextra-theme-blog or your custom theme
// Get the default MDX components
const themeComponents = getThemeComponents();
// Merge components
export function useMDXComponents(components = {}) {
return {
...themeComponents,
...components,
};
}

3
next-env.d.ts vendored
View File

@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -1,13 +0,0 @@
import nextra from 'nextra'
const withNextra = nextra({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx',
})
export default withNextra({
output: 'export',
images: {
unoptimized: true,
},
})

5
next.config.mjs Normal file
View File

@@ -0,0 +1,5 @@
import nextra from "nextra";
const withNextra = nextra({});
export default withNextra({});

View File

@@ -1,21 +1,21 @@
{
"private": true,
"license": "MIT",
"type": "module",
"scripts": {
"build": "NEXT_TELEMETRY_DISABLED=1 next build",
"dev": "NEXT_TELEMETRY_DISABLED=1 next dev",
"start": "pnpm dlx serve out"
"dev": "next",
"build": "next build",
"start": "next start",
"postbuild": "pagefind --site .next/server/app --output-path public/_pagefind"
},
"dependencies": {
"next": "^14.2.32",
"nextra": "^3.3.1",
"nextra-theme-docs": "^3.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"next": "^15.5.2",
"nextra": "^4.4.0",
"nextra-theme-docs": "^4.4.0",
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
"packageManager": "pnpm@10.15.1",
"devDependencies": {
"@types/node": "^22.18.1"
},
"packageManager": "pnpm@10.15.1"
"@types/node": "24.3.1",
"@types/react": "19.1.12",
"pagefind": "^1.4.0"
}
}

1292
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

2
pnpm-workspace.yaml Normal file
View File

@@ -0,0 +1,2 @@
onlyBuiltDependencies:
- sharp

View File

@@ -1,27 +0,0 @@
export default {
logo: <span>Memoir</span>,
docsRepositoryBase: 'https://github.com/cupcakearmy/memoir/blob/main',
project: {
link: 'https://github.com/cupcakearmy/memoir',
},
sidebar: {
defaultMenuCollapseLevel: 1,
},
feedback: {
content: 'Question? An error? Give feedback →',
},
head: (
<script defer src="https://spectare.nicco.io//unicorn.js" data-website-id="4aecaa6f-1e68-4a21-960a-8ff5aaa6599a"></script>
),
footer: {
text: (
<span>
MIT {new Date().getFullYear()} ©{' '}
<a href="https://github.com/cupcakearmy" target="_blank">
cupcakearmy
</a>
.
</span>
),
},
}

View File

@@ -1,10 +1,7 @@
{
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
@@ -12,17 +9,16 @@
"incremental": true,
"module": "esnext",
"esModuleInterop": true,
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}