Skip to content

Commit

Permalink
Update to Next.js v15
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorKowalczyk committed Oct 22, 2024
1 parent fc1dcb2 commit d1d3984
Show file tree
Hide file tree
Showing 6 changed files with 329 additions and 337 deletions.
9 changes: 5 additions & 4 deletions app/api/og/repository/[owner]/[repository]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ interface Params {
owner: string;
}

export async function GET(request: NextRequest, context: { params: Params }) {
export async function GET(request: NextRequest, context: { params: Promise<Params> }) {
const start = Date.now();
const params = await context.params;

if (!context.params) return redirect("/opengraph-image");
if (!params) return redirect("/opengraph-image");

const repo = context.params.repository;
const { owner } = context.params;
const repo = params.repository;
const { owner } = params;

const { theme } = Object.fromEntries(new URL(request.url.replaceAll("&amp%3B", "&")).searchParams.entries()) || "dark";

Expand Down
14 changes: 8 additions & 6 deletions app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import Avatar from "/public/assets/avatar.png";
import Avatar from "@/public/assets/avatar.png";

Check warning on line 1 in app/blog/[slug]/page.tsx

View workflow job for this annotation

GitHub Actions / ESLint (lts/*)

`@/public/assets/avatar.png` import should occur after import of `@/lib/utils`
import { allBlogs } from "contentlayer/generated";
import { parseISO } from "@/lib/utils";
import { meta } from "@/config";
import { MDXComponent } from "@/components/MDXComponents";

Check warning on line 3 in app/blog/[slug]/page.tsx

View workflow job for this annotation

GitHub Actions / ESLint (lts/*)

`@/components/MDXComponents` import should occur after import of `@/components/Headers`
import Image from "next/image";

Check warning on line 4 in app/blog/[slug]/page.tsx

View workflow job for this annotation

GitHub Actions / ESLint (lts/*)

`next/image` import should occur after import of `next`
import Link from "next/link";

Check warning on line 5 in app/blog/[slug]/page.tsx

View workflow job for this annotation

GitHub Actions / ESLint (lts/*)

`next/link` import should occur after import of `next`
import "styles/blog.css";
import { Metadata } from "next";
import { notFound } from "next/navigation";
import { Header1 } from "@/components/Headers";
import { meta } from "@/config";
import { cn } from "@/lib/utils";
import { Metadata } from "next";
import { parseISO } from "@/lib/utils";

export function generateStaticParams() {
return allBlogs.map((post) => ({
slug: post.slug,
}));
}

export async function generateMetadata({ params }): Promise<Metadata | undefined> {
export async function generateMetadata(props): Promise<Metadata | undefined> {
const params = await props.params;
const post = allBlogs.find((post) => post?.slug === params?.slug);

if (!post) return {};
Expand All @@ -42,7 +43,8 @@ export async function generateMetadata({ params }): Promise<Metadata | undefined
};
}

export default function Blog({ params }) {
export default async function Blog(props0) {
const params = await props0.params;
const post = allBlogs.find((post) => post.slug === params.slug);

if (!post) return notFound();
Expand Down
2 changes: 1 addition & 1 deletion app/uses/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { allOtherPages } from "contentlayer/generated";
import Image from "next/image";
import setup from "/public/assets/setup.jpg";
import Link from "next/link";
import { notFound } from "next/navigation";
import { Header1 } from "@/components/Headers";
import { MDXComponent } from "@/components/MDXComponents";
import setup from "@/public/assets/setup.jpg";

export const metadata = {
title: "What I use",
Expand Down
4 changes: 2 additions & 2 deletions next.config.mjs → next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NextConfig } from "next";
import { withContentlayer } from "next-contentlayer2";

/** @type {import('next').NextConfig} */
const nextConfig = {
const nextConfig: NextConfig = {
pageExtensions: ["jsx", "js", "ts", "tsx", "mdx"],
env: {
VERSION: process.env.npm_package_version,
Expand Down
23 changes: 15 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"private": true,
"scripts": {
"start": "next start",
"dev": "next dev",
"dev": "next dev --turbo",
"dev:turbo": " next dev --turbo --show-all",
"build": "next build",
"deploy": "pnpm run build && pnpm run start",
Expand All @@ -28,13 +28,14 @@
"geist": "1.3.1",
"github-slugger": "2.0.0",
"lucide-react": "0.453.0",
"next": "14.2.15",
"mdx-bundler": "10.0.3",
"next": "15.0.0",
"next-contentlayer2": "0.5.1",
"next-nprogress-bar": "2.3.14",
"next-themes": "0.3.0",
"nprogress": "0.2.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react": "19.0.0-rc-65a56d0e-20241020",
"react-dom": "19.0.0-rc-65a56d0e-20241020",
"reading-time": "1.5.0",
"rehype-autolink-headings": "7.1.0",
"rehype-pretty-code": "0.14.0",
Expand All @@ -49,12 +50,12 @@
"devDependencies": {
"@igorkowalczyk/eslint-config": "3.0.0-beta.11",
"@igorkowalczyk/prettier-config": "3.0.0-beta.11",
"@next/bundle-analyzer": "14.2.15",
"@next/bundle-analyzer": "15.0.0",
"@tailwindcss/aspect-ratio": "0.4.2",
"@tailwindcss/typography": "0.5.15",
"@types/node": "22.7.8",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.1",
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected].1",
"@types/validator": "13.12.2",
"autoprefixer": "10.4.20",
"eslint": "9.13.0",
Expand All @@ -80,5 +81,11 @@
"bugs": {
"url": "https://github.com/igorkowalczyk/igorkowalczyk.github.io/issues"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"pnpm": {
"overrides": {
"@types/react": "npm:[email protected]",
"@types/react-dom": "npm:[email protected]"
}
}
}
Loading

0 comments on commit d1d3984

Please sign in to comment.