Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update nextjs monorepo to v15 #541

Merged
merged 6 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
10 changes: 5 additions & 5 deletions apps/blog/app/[year]/[month]/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface Params {
}

interface PostProps {
params: Params
params: Promise<Params>
}

export const dynamic = 'force-static'
Expand All @@ -20,9 +20,8 @@ export const dynamic = 'force-static'
// https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#dynamicparams
export const dynamicParams = false

export default async function Post({
params: { year, month, slug },
}: PostProps) {
export default async function Post({ params }: PostProps) {
const { year, month, slug } = await params
const post = await getPost([year, month, slug])

return (
Expand Down Expand Up @@ -53,8 +52,9 @@ export async function generateStaticParams() {
}

export async function generateMetadata({
params: { year, month, slug },
params,
}: PostProps): Promise<Metadata> {
const { year, month, slug } = await params
const post = await getPost([year, month, slug])

return {
Expand Down
9 changes: 5 additions & 4 deletions apps/blog/app/[year]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react'

import Container from '@duyet/components/Container'
import Header from '@duyet/components/Header'
import React from 'react'

interface YearLayoutProps {
params: {
params: Promise<{
year: number
}
children: React.ReactNode
}>
children: React.ReactNode | React.ReactNode[]
}

export default function YearLayout({ children }: YearLayoutProps) {
Expand Down
8 changes: 5 additions & 3 deletions apps/blog/app/[year]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import { Year } from '../../components/year'
export const dynamicParams = false

interface YearProps {
params: {
params: Promise<{
year: number
}
}>
}

export default function YearPage({ params: { year } }: YearProps) {
export default async function YearPage({ params }: YearProps) {
const { year } = await params

return (
<>
<Year year={year} />
Expand Down
13 changes: 8 additions & 5 deletions apps/blog/app/category/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@ import Feed from '@duyet/components/Feed'
import { getAllCategories, getPostsByCategory } from '@duyet/libs/getPost'
import { getSlug } from '@duyet/libs/getSlug'

interface Params {
category: string
}

interface PostsByCategoryProps {
params: {
category: string
}
params: Promise<Params>
}

export default async function PostsByCategory({
params,
}: PostsByCategoryProps) {
const posts = await getPosts(params.category)
const { category } = await params
const posts = await getPosts(category)

return <Feed posts={posts} />
}

async function getPosts(category: PostsByCategoryProps['params']['category']) {
async function getPosts(category: Params['category']) {
return getPostsByCategory(category, [
'slug',
'date',
Expand Down
8 changes: 5 additions & 3 deletions apps/blog/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import Header from '@duyet/components/Header'
import { getAllPosts } from '@duyet/libs/getPost'
import Link from 'next/link'

type Params = Record<string, string>
type Params = Promise<Record<string, string>>

async function getPosts(params: Params) {
const page = params.page ? parseInt(params.page) - 1 : 0
const { page } = await params
const pageNumber = page ? parseInt(page) - 1 : 0

return getAllPosts(
[
Expand All @@ -19,12 +20,13 @@ async function getPosts(params: Params) {
'category',
'category_slug',
],
page * 10 + 10,
pageNumber * 10 + 10,
)
}

export default async function Page({ params }: { params: Params }) {
const posts = await getPosts(params)

return (
<>
<Header center logo={false} longText="Data Engineering" />
Expand Down
7 changes: 4 additions & 3 deletions apps/blog/app/series/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { notFound } from 'next/navigation'
import { SeriesBox } from '../../../components/series'

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

export default function SeriesPage({ params: { slug } }: PageProps) {
export default async function SeriesPage({ params }: PageProps) {
const { slug } = await params
const series = getSeries({ slug })

if (!series) {
Expand Down
13 changes: 8 additions & 5 deletions apps/blog/app/tag/[tag]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ import Feed from '@duyet/components/Feed'
import { getAllTags, getPostsByTag } from '@duyet/libs/getPost'
import { getSlug } from '@duyet/libs/getSlug'

interface Params {
tag: string
}

interface PostsByTagProps {
params: {
tag: string
}
params: Promise<Params>
}

export default async function PostsByTag({ params }: PostsByTagProps) {
const posts = await getPosts(params.tag)
const { tag } = await params
const posts = await getPosts(tag)

return <Feed posts={posts} />
}

async function getPosts(tag: PostsByTagProps['params']['tag']) {
async function getPosts(tag: Params['tag']) {
return getPostsByTag(tag, [
'slug',
'date',
Expand Down
1 change: 0 additions & 1 deletion apps/blog/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const redirects = require('./next.redirects')
* @type {import('next').NextConfig}
*/
const config = {
swcMinify: true,
transpilePackages: ['@duyet/components', '@duyet/libs'],
images: {
dangerouslyAllowSVG: true,
Expand Down
23 changes: 14 additions & 9 deletions apps/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,26 @@
"scripts": {
"analyze": "cross-env ANALYZE=true next build",
"build": "next build",
"dev": "next dev -p 3000",
"dev": "next dev --turbopack -p 3000",
"fix": "prettier --write \"**/*.{ts,tsx,md}\" .",
"fmt": "yarn fix",
"lint": "next lint",
"prettier-check": "prettier --check .",
"start": "next start"
},
"prettier": "@duyet/prettier",
"resolutions": {
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]",
"react-is": "19.0.0-rc-02c0e824-20241028"
},
"dependencies": {
"@auth0/auth0-react": "^2.2.4",
"@duyet/components": "*",
"@duyet/libs": "*",
"@headlessui/tailwindcss": "^0.2.0",
"@headlessui/tailwindcss": "^0.2.1",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-toggle-group": "^1.0.3",
"@radix-ui/react-toggle-group": "^1.1.0",
"@tremor/react": "^3.0.0",
"@vercel/analytics": "^1.0.0",
"@vercel/kv": "^3.0.0",
Expand All @@ -35,11 +40,11 @@
"graphql-request": "^6.0.0",
"katex": "^0.16.11",
"lucide-react": "^0.453.0",
"next": "^14.1.3",
"next": "15.0.2",
"next-axiom": "^1.3.0",
"next-themes": "^0.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "19.0.0-rc-02c0e824-20241028",
"react-dom": "19.0.0-rc-02c0e824-20241028",
"rehype-katex": "^7.0.1",
"remark-math": "^6.0.0",
"rss": "^1.2.2",
Expand All @@ -53,10 +58,10 @@
"@duyet/prettier": "*",
"@duyet/tailwind-config": "*",
"@duyet/tsconfig": "*",
"@next/bundle-analyzer": "^14.1.3",
"@next/bundle-analyzer": "15.0.2",
"@types/node": "^20.0.0",
"@types/react": "^18.0.23",
"@types/react-dom": "^18.0.7",
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"@types/rss": "^0.0.32",
"autoprefixer": "^10.4.12",
"cross-env": "^7.0.3",
Expand Down
1 change: 1 addition & 0 deletions apps/cv/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export default function RootLayout({ children }: LayoutProps) {
fontFamily:
'-apple-system, BlinkMacSystemFont, ui-sans-serif, system-ui, var(--font-inter)',
}}
suppressHydrationWarning
>
<Head />

Expand Down
Loading
Loading