Skip to content

Commit

Permalink
chore(deps): update all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
zce committed Oct 31, 2024
1 parent 1d67422 commit 4153bc4
Show file tree
Hide file tree
Showing 5 changed files with 668 additions and 622 deletions.
32 changes: 15 additions & 17 deletions examples/nextjs/app/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,17 @@ import { notFound } from 'next/navigation'
import { MDXContent } from '@/components/mdx-content'
import { pages } from '#site/content'

import type { Metadata } from 'next'

type Props = {
params: {
slug: string
}
params: Promise<{ slug: string }>
}

function getPageBySlug(slug: string) {
return pages.find(page => page.slug === slug)
}

export function generateMetadata({ params }: Props): Metadata {
const page = getPageBySlug(params.slug)
if (page == null) return {}
return { title: page.title }
}

export function generateStaticParams(): Props['params'][] {
return pages.map(page => ({ slug: page.slug }))
}

export default function PagePage({ params }: Props) {
const page = getPageBySlug(params.slug)
export default async function PagePage({ params }: Props) {
const { slug } = await params
const page = getPageBySlug(slug)

if (page == null) notFound()

Expand All @@ -38,3 +25,14 @@ export default function PagePage({ params }: Props) {
</article>
)
}

export async function generateMetadata({ params }: Props) {
const { slug } = await params
const page = getPageBySlug(slug)
if (page == null) return {}
return { title: page.title }
}

export function generateStaticParams() {
return pages.map(page => ({ slug: page.slug }))
}
5 changes: 1 addition & 4 deletions examples/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { Inter } from 'next/font/google'
import Link from 'next/link'

import { ModeToggle } from '@/components/mode-toggle'
import { ThemeProvider } from '@/components/theme-provider'

import './globals.css'

const inter = Inter({ subsets: ['latin'] })

export const metadata = {
title: 'Create Next App',
description: 'Generated by create next app'
Expand All @@ -20,7 +17,7 @@ interface RootLayoutProps {
export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en" suppressHydrationWarning>
<body className={`min-h-screen bg-white text-slate-900 antialiased dark:bg-slate-950 dark:text-slate-50 ${inter.className}`}>
<body className="min-h-screen bg-white text-slate-900 antialiased dark:bg-slate-950 dark:text-slate-50">
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
<div className="mx-auto max-w-2xl px-4 py-10">
<header>
Expand Down
34 changes: 15 additions & 19 deletions examples/nextjs/app/posts/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,17 @@ import { notFound } from 'next/navigation'

import { posts } from '#site/content'

import type { Metadata } from 'next'

interface PostProps {
params: {
slug: string
}
params: Promise<{ slug: string }>
}

function getPostBySlug(slug: string) {
return posts.find(post => post.slug === slug)
}

export function generateMetadata({ params }: PostProps): Metadata {
const post = getPostBySlug(params.slug)
if (post == null) return {}
return { title: post.title, description: post.description }
}

export function generateStaticParams(): PostProps['params'][] {
return posts.map(post => ({
slug: post.slug
}))
}

export default function PostPage({ params }: PostProps) {
const post = getPostBySlug(params.slug)
export default async function PostPage({ params }: PostProps) {
const { slug } = await params
const post = getPostBySlug(slug)

if (post == null) notFound()

Expand All @@ -42,3 +27,14 @@ export default function PostPage({ params }: PostProps) {
</article>
)
}

export async function generateMetadata({ params }: PostProps) {
const { slug } = await params
const post = getPostBySlug(slug)
if (post == null) return {}
return { title: post.title, description: post.description }
}

export function generateStaticParams() {
return posts.map(post => ({ slug: post.slug }))
}
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@
"*.{js,ts,md}": "prettier --write"
},
"dependencies": {
"@mdx-js/mdx": "^3.0.1",
"@mdx-js/mdx": "^3.1.0",
"esbuild": "^0.24.0",
"sharp": "^0.33.5",
"terser": "^5.34.1"
"terser": "^5.36.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^28.0.0",
"@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.3.0",
"@types/hast": "^3.0.4",
"@types/mdast": "^4.0.4",
"@types/node": "^20.16.11",
"@types/node": "^22.8.4",
"@types/picomatch": "^3.0.1",
"@zce/prettier-config": "^0.4.0",
"chokidar": "^4.0.1",
"fast-glob": "^3.3.2",
"hast-util-raw": "^9.0.4",
"hast-util-to-string": "^3.0.1",
"lint-staged": "^15.2.10",
"mdast-util-from-markdown": "^2.0.1",
"mdast-util-from-markdown": "^2.0.2",
"mdast-util-to-hast": "^13.2.0",
"mdast-util-toc": "^7.1.0",
"picomatch": "^4.0.2",
Expand All @@ -66,19 +66,19 @@
"remark-gfm": "^4.0.0",
"remark-parse": "^11.0.0",
"remark-rehype": "^11.1.1",
"rollup": "^4.24.0",
"rollup": "^4.24.3",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-esbuild": "^6.1.1",
"simple-git-hooks": "^2.11.1",
"tsx": "^4.19.1",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"unified": "^11.0.5",
"unist-util-visit": "^5.0.0",
"vfile": "^6.0.3",
"vfile-reporter": "^8.1.1",
"yaml": "^2.5.1"
"yaml": "^2.6.0"
},
"packageManager": "[email protected].1",
"packageManager": "[email protected].3",
"engines": {
"node": "^18.17.0 || >=20.3.0"
}
Expand Down
Loading

0 comments on commit 4153bc4

Please sign in to comment.