Skip to content

Commit c0f3f49

Browse files
committed
update to nextjs 15
easy easy easy easy easy easy easy easy easy easy easy easy asd test easy easy
1 parent b2c3496 commit c0f3f49

File tree

20 files changed

+204
-98
lines changed

20 files changed

+204
-98
lines changed

.eslintrc.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: self-hosted
1313

1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616

1717
- name: Create env file
1818
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ WORKDIR /app
55
COPY package.json ./
66
COPY prisma ./prisma
77

8-
RUN npm install
8+
RUN npm install --force
99

1010
#
1111
FROM node:20-alpine AS builder

eslint.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from "@eslint/js";
2+
import nextPlugin from "@next/eslint-plugin-next";
3+
import tsParser from "@typescript-eslint/parser";
4+
import reactHooksPlugin from "eslint-plugin-react-hooks";
5+
import globals from "globals";
6+
7+
export default [
8+
js.configs.recommended,
9+
{
10+
files: ["**/*.{js,jsx,ts,tsx}"],
11+
languageOptions: {
12+
parser: tsParser,
13+
globals: {
14+
...globals.browser,
15+
...globals.es2021,
16+
...globals.node,
17+
React: "readonly",
18+
},
19+
},
20+
plugins: {
21+
"@next/next": nextPlugin,
22+
"react-hooks": reactHooksPlugin,
23+
},
24+
rules: {
25+
"react-hooks/exhaustive-deps": "off",
26+
"no-unused-vars": [
27+
"warn",
28+
{
29+
varsIgnorePattern: "^(NodeJS|other)$",
30+
ignoreRestSiblings: true,
31+
args: "none",
32+
caughtErrors: "none",
33+
},
34+
],
35+
...nextPlugin.configs.recommended.rules,
36+
},
37+
},
38+
];

next.config.mjs

Lines changed: 0 additions & 4 deletions
This file was deleted.

next.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
poweredByHeader: false,
6+
};
7+
8+
export default nextConfig;

package.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "next-elysia-prisma",
33
"version": "1.0.0",
4+
"type": "module",
45
"private": true,
56
"scripts": {
6-
"dev": "next dev",
7+
"dev": "next dev --turbopack",
78
"build": "next build",
89
"start": "prisma migrate deploy && next start",
910
"lint": "next lint",
@@ -12,26 +13,26 @@
1213
},
1314
"dependencies": {
1415
"@elysiajs/eden": "^1.1.3",
15-
"@prisma/client": "^5.20.0",
16-
"@tanstack/react-query": "^5.59.6",
17-
"elysia": "^1.1.19",
18-
"jose": "^5.9.3",
19-
"next": "14.2.15",
20-
"react": "^18",
21-
"react-dom": "^18"
16+
"@prisma/client": "^5.22.0",
17+
"@tanstack/react-query": "^5.61.0",
18+
"elysia": "^1.1.25",
19+
"jose": "^5.9.6",
20+
"next": "15.0.3",
21+
"react": "19.0.0-rc-66855b96-20241106",
22+
"react-dom": "19.0.0-rc-66855b96-20241106"
2223
},
2324
"devDependencies": {
24-
"@types/bun": "^1.1.11",
25-
"@types/node": "^22.7.5",
25+
"@types/bun": "^1.1.13",
26+
"@types/node": "^22.9.1",
2627
"@types/react": "^18",
2728
"@types/react-dom": "^18",
28-
"eslint": "^8",
29-
"eslint-config-next": "14.2.15",
29+
"eslint": "^9.15.0",
30+
"eslint-config-next": "15.0.3",
3031
"postcss": "^8",
3132
"prettier": "^3.3.3",
32-
"prettier-plugin-tailwindcss": "^0.6.8",
33-
"prisma": "^5.20.0",
34-
"tailwindcss": "^3.4.13",
33+
"prettier-plugin-tailwindcss": "^0.6.9",
34+
"prisma": "^5.22.0",
35+
"tailwindcss": "^3.4.15",
3536
"typescript": "^5"
3637
}
37-
}
38+
}

src/app/(auth)/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ export default async function AuthLayout(props: AuthLayoutProps) {
1313
const queryClient = getQueryClient();
1414

1515
// Fetch current user data set cookies are required else they will be empty
16-
const { data: me, error: meError } = await rpc.api.user.me.get(setCookies());
16+
const { error: meError } = await rpc.api.user.me.get(await setCookies());
1717

1818
// serverUrl is a custom function because nextjs doesnt provide a way to read current url in server components
19-
if (!meError && !serverUrl()?.includes("logout")) redirect("/dashboard");
19+
if (!meError && !(await serverUrl())?.includes("logout"))
20+
redirect("/dashboard");
2021

2122
return (
2223
<HydrationBoundary state={dehydrate(queryClient)}>

src/app/(auth)/login/page.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { AuthHook } from "@/components/hooks/auth-hook";
4-
import { authUser } from "@/lib/typebox/auth";
4+
import { authenticationSchema, authSchemas } from "@/lib/typebox/auth";
55
import Link from "next/link";
66
import { useRouter } from "next/navigation";
77
import { FormEvent, useState } from "react";
@@ -22,7 +22,7 @@ export default function LoginPage(props: LoginPageProps) {
2222
username,
2323
password,
2424
})
25-
.then((user) => (user ? router.push("/dashboard") : setStatus(user)))
25+
.then(() => router.push("/dashboard"))
2626
.catch((error) => setStatus(JSON.stringify(error)));
2727
};
2828

@@ -34,23 +34,38 @@ export default function LoginPage(props: LoginPageProps) {
3434
id="username"
3535
type="text"
3636
value={username}
37-
minLength={authUser.properties.username.minLength}
37+
minLength={authenticationSchema.properties.username.minLength}
38+
maxLength={authenticationSchema.properties.username.maxLength}
3839
onChange={(e) => setUsername(e.target.value)}
3940
required
41+
autoComplete="username"
4042
/>
4143
</div>
4244
<div className="flex flex-col border">
4345
<label htmlFor="password">Password</label>
4446
<input
4547
id="password"
4648
type="password"
49+
minLength={authenticationSchema.properties.password.minLength}
50+
maxLength={authenticationSchema.properties.password.maxLength}
4751
value={password}
4852
onChange={(e) => setPassword(e.target.value)}
4953
required
54+
autoComplete="current-password"
5055
/>
5156
</div>
5257
<div className="flex justify-between">
53-
<button className="bg-red-600" type="submit">
58+
<button
59+
className="bg-red-600 disabled:bg-gray-600"
60+
type="submit"
61+
disabled={
62+
loginMutation.isPending ||
63+
!authSchemas.authUser.safeParse({
64+
username,
65+
password,
66+
}).success
67+
}
68+
>
5469
Login
5570
</button>
5671

src/app/(auth)/register/page.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
"use client";
22

33
import { AuthHook } from "@/components/hooks/auth-hook";
4+
import { authenticationSchema, authSchemas } from "@/lib/typebox/auth";
45
import Link from "next/link";
56
import { useRouter } from "next/navigation";
67
import { FormEvent, useState } from "react";
78

8-
interface RegisterPageProps {}
9-
10-
export default function RegisterPage(props: RegisterPageProps) {
9+
export default function RegisterPage() {
1110
const router = useRouter();
1211
const { registerMutation } = AuthHook();
1312
const [status, setStatus] = useState("");
@@ -21,7 +20,7 @@ export default function RegisterPage(props: RegisterPageProps) {
2120
username,
2221
password,
2322
})
24-
.then((user) => (user ? router.push("/dashboard") : setStatus(user)))
23+
.then(() => router.push("/dashboard"))
2524
.catch((error) => setStatus(JSON.stringify(error)));
2625
};
2726

@@ -34,7 +33,10 @@ export default function RegisterPage(props: RegisterPageProps) {
3433
type="text"
3534
value={username}
3635
onChange={(e) => setUsername(e.target.value)}
36+
minLength={authenticationSchema.properties.username.minLength}
37+
maxLength={authenticationSchema.properties.username.maxLength}
3738
required
39+
autoComplete="username"
3840
/>
3941
</div>
4042
<div className="flex flex-col border">
@@ -43,12 +45,25 @@ export default function RegisterPage(props: RegisterPageProps) {
4345
id="password"
4446
type="password"
4547
value={password}
48+
minLength={authenticationSchema.properties.password.minLength}
49+
maxLength={authenticationSchema.properties.password.maxLength}
4650
onChange={(e) => setPassword(e.target.value)}
4751
required
52+
autoComplete="current-password"
4853
/>
4954
</div>
5055
<div className="flex justify-between">
51-
<button className="bg-red-600" type="submit">
56+
<button
57+
className="bg-red-600 disabled:bg-gray-600"
58+
type="submit"
59+
disabled={
60+
registerMutation.isPending ||
61+
!authSchemas.authUser.safeParse({
62+
username,
63+
password,
64+
}).success
65+
}
66+
>
5267
Register
5368
</button>
5469

0 commit comments

Comments
 (0)