Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit 89a33a0

Browse files
committed
Refactor components to use updated Clerk/Next.js imports
1 parent 31b806d commit 89a33a0

File tree

8 files changed

+51
-70
lines changed

8 files changed

+51
-70
lines changed

app/api/github/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextResponse } from "next/server";
22
import type { NextRequest } from "next/server";
33
import createOctokitInstance from "../../../lib/createOctokitInstance";
4-
import { auth } from "@clerk/nextjs";
4+
import { auth } from "@clerk/nextjs/server";
55

66
/**
77
* Handles GitHub API requests and responses.

app/api/star-history/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NextRequest, NextResponse } from "next/server";
22
import createOctokitInstance from "../../../lib/createOctokitInstance";
3-
import { auth } from "@clerk/nextjs";
3+
import { auth } from "@clerk/nextjs/server";
44

55
/**
66
* Fetches stargazers for a GitHub repo from the GitHub API.

app/auth/profile/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import {
1111
Tooltip,
1212
} from "@radix-ui/themes";
1313
import { useEffect } from "react";
14-
import { useUser } from "@clerk/nextjs";
1514
import FaqAccordion from "@/components/auth/FaqAccordion";
1615
import { convertUnixTimestampToDate, getSiteUrl } from "@/lib/utils";
1716
import { GoEyeClosed } from "react-icons/go";
1817
import { GoEye } from "react-icons/go";
1918
import Link from "next/link";
2019
import { Endpoints } from "@octokit/types";
20+
import { useUser } from "@clerk/nextjs";
2121

2222
export default function Page() {
2323
const { user } = useUser();

app/layout.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ export default function RootLayout({
8989
}}
9090
>
9191
<html lang="en">
92-
<Head>
93-
<meta
94-
name="google-adsense-account"
95-
content="ca-pub-9043926174238983"
96-
/>
97-
</Head>
9892
<body
9993
className={`${inter.className} flex min-h-screen w-full justify-center px-1 transition-all duration-1000 md:px-4`}
10094
>

bun.lockb

7.41 KB
Binary file not shown.

lib/createOctokitInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { clerkClient } from "@clerk/nextjs/server";
12
import { Octokit } from "octokit";
2-
import { clerkClient } from "@clerk/nextjs";
33

44
export default async function createOctokitInstance(userId?: string) {
55
let auth;

middleware.ts

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
1-
import { authMiddleware } from "@clerk/nextjs";
1+
import { clerkMiddleware, createRouteMatcher } from "@clerk/nextjs/server";
22

3-
/**
4-
* Configures authentication middleware with public and ignored routes.
5-
*
6-
* @param config - Configuration object with `publicRoutes` and `ignoredRoutes` arrays.
7-
* `publicRoutes` defines routes that can be accessed while signed out.
8-
* `ignoredRoutes` defines routes that can always be accessed without authentication.
9-
*/
10-
export default authMiddleware({
11-
// Routes that can be accessed while signed out
12-
publicRoutes: [
13-
"/",
14-
"/:username",
15-
"/api/github",
16-
"/api/star-history",
17-
"/blog/:postId",
18-
],
19-
// Routes that can always be accessed, and have
20-
// no authentication information
21-
ignoredRoutes: [""],
3+
const isDashboardRoute = createRouteMatcher(["/dashboard(.*)"]);
4+
const isAdminRoute = createRouteMatcher(["/admin(.*)"]);
5+
6+
export default clerkMiddleware((auth, req) => {
7+
// Restrict admin route to users with specific role
8+
if (isAdminRoute(req)) auth().protect({ role: "org:admin" });
9+
10+
// Restrict dashboard routes to signed in users
11+
if (isDashboardRoute(req)) auth().protect();
2212
});
2313

2414
export const config = {
25-
// Protects all routes, including api/trpc.
26-
// See https://clerk.com/docs/references/nextjs/auth-middleware
27-
// for more information about configuring your Middleware
28-
matcher: ["/((?!.+\\.[\\w]+$|_next).*)", "/", "/(api|trpc)(.*)"],
15+
matcher: ["/((?!.*\\..*|_next).*)", "/", "/(api|trpc)(.*)"],
2916
};

package.json

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,66 +9,66 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@clerk/nextjs": "^4.29.9",
13-
"@clerk/themes": "^1.7.9",
12+
"@clerk/nextjs": "^5.1.0",
13+
"@clerk/themes": "1.7.15",
1414
"@emotion/react": "^11.11.4",
15-
"@emotion/styled": "^11.11.0",
16-
"@hookform/resolvers": "^3.3.4",
17-
"@mui/material": "^5.15.12",
18-
"@mui/x-charts": "^6.19.5",
19-
"@mui/x-data-grid": "^6.19.6",
20-
"@next/third-parties": "^14.1.0",
15+
"@emotion/styled": "11.11.5",
16+
"@hookform/resolvers": "3.4.2",
17+
"@mui/material": "5.15.18",
18+
"@mui/x-charts": "6.19.8",
19+
"@mui/x-data-grid": "6.19.11",
20+
"@next/third-parties": "14.2.3",
2121
"@octokit/types": "^12.6.0",
2222
"@radix-ui/react-accordion": "^1.1.2",
2323
"@radix-ui/react-select": "^2.0.0",
2424
"@radix-ui/themes": "^2.0.3",
25-
"@tanstack/react-table": "^8.12.0",
26-
"@uiw/react-json-view": "^2.0.0-alpha.18",
27-
"@uiw/react-markdown-preview": "^5.0.7",
25+
"@tanstack/react-table": "8.17.3",
26+
"@uiw/react-json-view": "2.0.0-alpha.24",
27+
"@uiw/react-markdown-preview": "5.1.1",
2828
"@vercel/analytics": "^1.2.2",
2929
"@vercel/speed-insights": "^1.0.10",
3030
"class-variance-authority": "^0.7.0",
31-
"clsx": "^2.1.0",
31+
"clsx": "2.1.1",
3232
"cmdk": "^0.2.1",
33-
"date-fns": "^3.3.1",
33+
"date-fns": "3.6.0",
3434
"gray-matter": "^4.0.3",
3535
"install": "^0.13.0",
3636
"lodash": "^4.17.21",
3737
"lucide-react": "^0.344.0",
38-
"next": "14.1.3",
38+
"next": "^14.2.3",
3939
"next-themes": "^0.2.1",
4040
"nextjs-google-adsense": "^1.0.0",
41-
"npm": "^10.5.0",
42-
"octokit": "^3.1.2",
43-
"react": "^18.2.0",
44-
"react-day-picker": "^8.10.0",
45-
"react-dom": "^18.2.0",
46-
"react-hook-form": "^7.50.1",
47-
"react-icons": "^5.0.1",
48-
"react-json-view-lite": "^1.2.1",
41+
"npm": "10.8.0",
42+
"octokit": "3.2.1",
43+
"react": "18.3.1",
44+
"react-day-picker": "8.10.1",
45+
"react-dom": "18.3.1",
46+
"react-hook-form": "7.51.5",
47+
"react-icons": "5.2.1",
48+
"react-json-view-lite": "1.4.0",
4949
"react-markdown": "^9.0.1",
5050
"remark": "^15.0.1",
5151
"remark-html": "^16.0.1",
52-
"sonner": "^1.4.3",
53-
"tailwind-merge": "^2.2.1",
52+
"sonner": "1.4.41",
53+
"tailwind-merge": "2.3.0",
5454
"tailwindcss-animate": "^1.0.7",
55-
"vaul": "^0.9.0",
55+
"vaul": "0.9.1",
5656
"virtua": "^0.28.0",
57-
"zod": "^3.22.4"
57+
"zod": "3.23.8"
5858
},
5959
"devDependencies": {
60-
"@types/lodash": "^4.14.202",
61-
"@types/node": "^20.11.25",
62-
"@types/react": "^18.2.57",
63-
"@types/react-dom": "^18.2.19",
60+
"@types/lodash": "4.17.4",
61+
"@types/node": "20.12.12",
62+
"@types/react": "18.3.2",
63+
"@types/react-dom": "18.3.0",
6464
"@types/react-window": "^1.8.8",
65-
"autoprefixer": "^10.4.17",
65+
"autoprefixer": "10.4.19",
6666
"eslint": "^8.57.0",
6767
"eslint-config-next": "14.1.1",
68-
"postcss": "^8.4.35",
68+
"postcss": "8.4.38",
6969
"prettier": "^3.2.5",
70-
"prettier-plugin-tailwindcss": "^0.5.11",
71-
"tailwindcss": "^3.4.1",
72-
"typescript": "^5.3.3"
70+
"prettier-plugin-tailwindcss": "0.5.14",
71+
"tailwindcss": "3.4.3",
72+
"typescript": "5.4.5"
7373
}
74-
}
74+
}

0 commit comments

Comments
 (0)