Skip to content

Commit

Permalink
chore(deps): update nextjs monorepo to v15 (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
duyet authored Oct 30, 2024
2 parents 5ee51bf + dc507ce commit fc0c7dc
Show file tree
Hide file tree
Showing 28 changed files with 541 additions and 332 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
yarn lint-staged
yarn test
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
3 changes: 2 additions & 1 deletion apps/blog/app/archives/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'

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

export default function Layout({ children }: { children: React.ReactNode }) {
return (
Expand Down
10 changes: 6 additions & 4 deletions apps/blog/app/archives2/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Link from 'next/link'

import Container from '@duyet/components/Container'
import Grid from '@duyet/components/Grid'
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 @@ -18,7 +20,7 @@ async function getPosts(params: Params) {
'category',
'category_slug',
],
page * 10 + 10,
pageNumber * 10 + 10,
)
}

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
18 changes: 9 additions & 9 deletions apps/blog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"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",
Expand All @@ -22,9 +22,9 @@
"@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 +35,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 +53,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

3 comments on commit fc0c7dc

@vercel
Copy link

@vercel vercel bot commented on fc0c7dc Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cv – ./apps/cv

cv-git-master-duyet-team.vercel.app
duyet-cv.vercel.app
cv-duyet-team.vercel.app
cv.duyet.net

@vercel
Copy link

@vercel vercel bot commented on fc0c7dc Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

insights – ./apps/insights

insights-duyet-team.vercel.app
duyet-insights.vercel.app
insights.duyet.net
insights-git-master-duyet-team.vercel.app

@vercel
Copy link

@vercel vercel bot commented on fc0c7dc Oct 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.