1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2025-05-29 22:37:44 +02:00

build(deps): update Next.js to v15 and ESLint to v9

This commit is contained in:
2024-11-09 19:50:22 +01:00
parent 59153a7a69
commit 9e840b8dae
74 changed files with 3206 additions and 3749 deletions

View File

@ -1,14 +0,0 @@
{
"root": true,
"extends": ["@repo/eslint-config/nextjs/.eslintrc.json"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"plugins": ["@typescript-eslint"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"projectService": true
}
}
]
}

View File

@ -1,4 +1,4 @@
FROM node:22.4.1-slim AS node-pnpm
FROM node:22.11.0-slim AS node-pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
@ -8,7 +8,7 @@ WORKDIR /usr/src/app
FROM node-pnpm AS builder
COPY ./ ./
RUN pnpm install --global turbo@2.1.3
RUN pnpm install --global turbo@2.2.3
RUN turbo prune @repo/website --docker
FROM node-pnpm AS installer

View File

@ -4,19 +4,20 @@ import { notFound } from "next/navigation"
import { getBlogPostBySlug, getBlogPosts } from "@repo/blog"
import { BlogPostUI } from "@repo/blog/BlogPostUI"
import type { Locale } from "@repo/utils/constants"
import { unstable_setRequestLocale } from "next-intl/server"
import { setRequestLocale } from "next-intl/server"
interface BlogPostPageProps {
params: {
params: Promise<{
slug: string
locale: Locale
}
}>
}
export const generateMetadata = async (
props: BlogPostPageProps,
): Promise<Metadata> => {
const blogPost = await getBlogPostBySlug(props.params.slug)
const { slug } = await props.params
const blogPost = await getBlogPostBySlug(slug)
if (blogPost == null) {
return notFound()
}
@ -50,10 +51,11 @@ export const generateStaticParams = async (): Promise<
const BlogPostPage: React.FC<BlogPostPageProps> = async (props) => {
const { params } = props
const { locale, slug } = await params
// Enable static rendering
unstable_setRequestLocale(params.locale)
setRequestLocale(locale)
const blogPost = await getBlogPostBySlug(params.slug)
const blogPost = await getBlogPostBySlug(slug)
if (blogPost == null) {
return notFound()
}

View File

@ -1,6 +1,6 @@
import { getBlogPosts } from "@repo/blog"
import { BlogPosts } from "@repo/blog/BlogPosts"
import type { LocaleProps } from "@repo/i18n/config"
import type { LocaleProps } from "@repo/i18n/routing"
import { MainLayout } from "@repo/ui/Layout/MainLayout"
import {
Section,
@ -9,7 +9,7 @@ import {
} from "@repo/ui/Layout/Section"
import { LOCALE_DEFAULT } from "@repo/utils/constants"
import type { Metadata } from "next"
import { unstable_setRequestLocale } from "next-intl/server"
import { setRequestLocale } from "next-intl/server"
const title = "Blog | Théo LUDWIG"
const description =
@ -36,8 +36,9 @@ interface BlogPageProps extends LocaleProps {}
const BlogPage: React.FC<BlogPageProps> = async (props) => {
const { params } = props
const { locale } = await params
// Enable static rendering
unstable_setRequestLocale(params.locale)
setRequestLocale(locale)
const posts = await getBlogPosts()

View File

@ -1,18 +1,19 @@
import "@repo/config-tailwind/styles.css"
import type { LocaleProps } from "@repo/i18n/config"
import type { LocaleProps } from "@repo/i18n/routing"
import { Footer } from "@repo/ui/Layout/Footer"
import { Header } from "@repo/ui/Layout/Header"
import { ThemeProvider } from "@repo/ui/Layout/Header/SwitchTheme"
import { VERSION } from "@repo/utils/constants"
import { unstable_setRequestLocale } from "next-intl/server"
import { setRequestLocale } from "next-intl/server"
interface MainLayoutProps extends React.PropsWithChildren, LocaleProps {}
const MainLayout: React.FC<MainLayoutProps> = async (props) => {
const { children, params } = props
const { locale } = await params
// Enable static rendering
unstable_setRequestLocale(params.locale)
setRequestLocale(locale)
return (
<ThemeProvider>

View File

@ -1,4 +1,4 @@
import type { LocaleProps } from "@repo/i18n/config"
import type { LocaleProps } from "@repo/i18n/routing"
import { About } from "@repo/ui/Home/About"
import { Interests } from "@repo/ui/Home/Interests"
import { OpenSource } from "@repo/ui/Home/OpenSource"
@ -6,15 +6,16 @@ import { Portfolio } from "@repo/ui/Home/Portfolio"
import { Skills } from "@repo/ui/Home/Skills"
import { MainLayout } from "@repo/ui/Layout/MainLayout"
import { RevealFade } from "@repo/ui/Layout/Section"
import { unstable_setRequestLocale } from "next-intl/server"
import { setRequestLocale } from "next-intl/server"
interface HomePageProps extends LocaleProps {}
const HomePage: React.FC<HomePageProps> = (props) => {
const HomePage: React.FC<HomePageProps> = async (props) => {
const { params } = props
const { locale } = await params
// Enable static rendering
unstable_setRequestLocale(params.locale)
setRequestLocale(locale)
return (
<MainLayout>

View File

@ -1,7 +1,7 @@
import "@repo/config-tailwind/styles.css"
import type { LocaleProps } from "@repo/i18n/config"
import type { LocaleProps } from "@repo/i18n/routing"
import { ThemeProvider } from "@repo/ui/Layout/Header/SwitchTheme"
import { unstable_setRequestLocale } from "next-intl/server"
import { setRequestLocale } from "next-intl/server"
interface CurriculumVitaeLayoutProps
extends React.PropsWithChildren,
@ -12,8 +12,9 @@ const CurriculumVitaeLayout: React.FC<CurriculumVitaeLayoutProps> = async (
) => {
const { children, params } = props
const { locale } = await params
// Enable static rendering
unstable_setRequestLocale(params.locale)
setRequestLocale(locale)
return <ThemeProvider forcedTheme="light">{children}</ThemeProvider>
}

View File

@ -1,14 +1,15 @@
import type { LocaleProps } from "@repo/i18n/config"
import type { LocaleProps } from "@repo/i18n/routing"
import { CurriculumVitae } from "@repo/ui/CurriculumVitae"
import { unstable_setRequestLocale } from "next-intl/server"
import { setRequestLocale } from "next-intl/server"
interface CurriculumVitaeProps extends LocaleProps {}
const CurriculumVitaePage: React.FC<CurriculumVitaeProps> = (props) => {
const CurriculumVitaePage: React.FC<CurriculumVitaeProps> = async (props) => {
const { params } = props
const { locale } = await params
// Enable static rendering
unstable_setRequestLocale(params.locale)
setRequestLocale(locale)
return <CurriculumVitae />
}

View File

@ -1,5 +1,5 @@
import "@repo/config-tailwind/styles.css"
import type { LocaleProps } from "@repo/i18n/config"
import type { LocaleProps } from "@repo/i18n/routing"
import type { Locale } from "@repo/utils/constants"
import { LOCALES } from "@repo/utils/constants"
import type { Metadata } from "next"
@ -7,18 +7,19 @@ import { NextIntlClientProvider } from "next-intl"
import {
getMessages,
getTranslations,
unstable_setRequestLocale,
setRequestLocale,
} from "next-intl/server"
export const generateMetadata = async ({
params,
}: LocaleProps): Promise<Metadata> => {
const t = await getTranslations({ locale: params.locale })
const { locale } = await params
const t = await getTranslations({ locale })
const title = t("meta.title")
const description = `${title} - ${t("meta.description")}`
const image = "/images/logo.webp"
const url = new URL("https://theoludwig.fr")
const locale = LOCALES.join(", ")
const locales = LOCALES.join(", ")
return {
title,
@ -36,7 +37,7 @@ export const generateMetadata = async ({
height: 96,
},
],
locale,
locale: locales,
type: "website",
},
twitter: {
@ -61,13 +62,14 @@ interface LocaleLayoutProps extends React.PropsWithChildren, LocaleProps {}
const LocaleLayout: React.FC<LocaleLayoutProps> = async (props) => {
const { children, params } = props
const { locale } = await params
// Enable static rendering
unstable_setRequestLocale(params.locale)
setRequestLocale(locale)
const messages = await getMessages()
return (
<html lang={params.locale} suppressHydrationWarning>
<html lang={locale} suppressHydrationWarning>
<body>
<NextIntlClientProvider messages={messages}>
{children}

View File

@ -0,0 +1,13 @@
import typescriptESLint from "typescript-eslint"
import configNextjs from "@repo/eslint-config/nextjs"
export default typescriptESLint.config(...configNextjs, {
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: typescriptESLint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
})

View File

@ -1,3 +0,0 @@
import i18nConfig from "@repo/i18n/i18n"
export default i18nConfig

View File

@ -0,0 +1,3 @@
import i18nRequestConfig from "@repo/i18n/request"
export default i18nRequestConfig

View File

@ -1,25 +1,26 @@
import { LOCALES, LOCALE_DEFAULT, LOCALE_PREFIX } from "@repo/utils/constants"
import createMiddleware from "next-intl/middleware"
import { routing } from "@repo/i18n/routing"
import createIntlMiddleware from "next-intl/middleware"
export default createMiddleware({
locales: LOCALES,
defaultLocale: LOCALE_DEFAULT,
localePrefix: LOCALE_PREFIX,
})
const intlMiddleware = createIntlMiddleware(routing)
export default intlMiddleware
export const config = {
matcher: [
// Enable a redirect to a matching locale at the root
"/",
// Set a cookie to remember the previous locale for
// all requests that have a locale prefix
// Next.js issue, middleware matcher should support template literals:
// https://github.com/vercel/next.js/issues/56398
"/(en-US|fr-FR)/:path*",
// Enable redirects that add missing locales
// (e.g. `/pathnames` -> `/en/pathnames`)
"/((?!_next|_vercel|.*\\..*).*)",
/*
* Match all request paths except for the ones starting with:
* - api (API routes)
* - _next/static (static files)
* - _next/image (image optimization files)
* - favicon.ico (favicon file)
*/
"/((?!api|_next/static|_next/image|images|favicon.ico).*)",
],
}

View File

@ -7,10 +7,10 @@
"#*": "./*"
},
"scripts": {
"dev": "next dev --port 3000 --turbo",
"dev": "next dev --port 3000 --turbopack",
"build": "next build",
"start": "next start --port 3000",
"lint:eslint": "eslint . --max-warnings 0 --report-unused-disable-directives",
"lint:eslint": "eslint . --max-warnings 0",
"lint:typescript": "tsc --noEmit"
},
"dependencies": {
@ -34,6 +34,7 @@
"eslint": "catalog:",
"postcss": "catalog:",
"tailwindcss": "catalog:",
"typescript-eslint": "catalog:",
"typescript": "catalog:"
}
}