create-tnt-stack 0.4.2 → 0.4.4-beta.255730d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/index.js +22 -22
- package/package.json +86 -86
- package/template/base/README.md +1 -1
- package/template/packages/prisma/schema/{with-next-auth.prisma → with-authjs.prisma} +2 -2
- package/template/packages/src/app/layout/base.tsx +2 -2
- package/template/packages/src/app/page/base.tsx +80 -88
- package/template/packages/src/app/page/with-authjs.tsx +126 -0
- package/template/packages/src/app/page/with-payload.tsx +98 -20
- package/template/packages/src/server/auth/authjs.ts +5 -0
- package/template/packages/src/server/auth/config/authjs-with-prisma.ts +30 -0
- package/template/packages/src/server/auth/config/authjs.ts +27 -0
- package/template/packages/src/app/globals/with-payload.css +0 -166
- package/template/packages/src/app/layout/with-payload.tsx +0 -20
- package/template/packages/src/server/auth/config/next-auth-with-prisma.ts +0 -60
- package/template/packages/src/server/auth/config/next-auth.ts +0 -57
- package/template/packages/src/server/auth/next-auth.ts +0 -10
- /package/template/packages/src/env/{with-next-auth-db.js → with-authjs-db.js} +0 -0
- /package/template/packages/src/env/{with-next-auth.js → with-authjs.js} +0 -0
@@ -1,166 +0,0 @@
|
|
1
|
-
@import "tailwindcss";
|
2
|
-
|
3
|
-
:root {
|
4
|
-
--font-mono: "Roboto Mono", monospace;
|
5
|
-
}
|
6
|
-
|
7
|
-
* {
|
8
|
-
box-sizing: border-box;
|
9
|
-
}
|
10
|
-
|
11
|
-
html {
|
12
|
-
font-size: 18px;
|
13
|
-
line-height: 32px;
|
14
|
-
|
15
|
-
background: rgb(0, 0, 0);
|
16
|
-
-webkit-font-smoothing: antialiased;
|
17
|
-
}
|
18
|
-
|
19
|
-
html,
|
20
|
-
body,
|
21
|
-
#app {
|
22
|
-
height: 100%;
|
23
|
-
}
|
24
|
-
|
25
|
-
body {
|
26
|
-
font-family: system-ui;
|
27
|
-
font-size: 18px;
|
28
|
-
line-height: 32px;
|
29
|
-
|
30
|
-
margin: 0;
|
31
|
-
color: rgb(1000, 1000, 1000);
|
32
|
-
|
33
|
-
@media (max-width: 1024px) {
|
34
|
-
font-size: 15px;
|
35
|
-
line-height: 24px;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
|
39
|
-
img {
|
40
|
-
max-width: 100%;
|
41
|
-
height: auto;
|
42
|
-
display: block;
|
43
|
-
}
|
44
|
-
|
45
|
-
h1 {
|
46
|
-
margin: 40px 0;
|
47
|
-
font-size: 64px;
|
48
|
-
line-height: 70px;
|
49
|
-
font-weight: bold;
|
50
|
-
|
51
|
-
@media (max-width: 1024px) {
|
52
|
-
margin: 24px 0;
|
53
|
-
font-size: 42px;
|
54
|
-
line-height: 42px;
|
55
|
-
}
|
56
|
-
|
57
|
-
@media (max-width: 768px) {
|
58
|
-
font-size: 38px;
|
59
|
-
line-height: 38px;
|
60
|
-
}
|
61
|
-
|
62
|
-
@media (max-width: 400px) {
|
63
|
-
font-size: 32px;
|
64
|
-
line-height: 32px;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
p {
|
69
|
-
margin: 24px 0;
|
70
|
-
|
71
|
-
@media (max-width: 1024px) {
|
72
|
-
margin: calc(var(--base) * 0.75) 0;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
a {
|
77
|
-
color: currentColor;
|
78
|
-
|
79
|
-
&:focus {
|
80
|
-
opacity: 0.8;
|
81
|
-
outline: none;
|
82
|
-
}
|
83
|
-
|
84
|
-
&:active {
|
85
|
-
opacity: 0.7;
|
86
|
-
outline: none;
|
87
|
-
}
|
88
|
-
}
|
89
|
-
|
90
|
-
svg {
|
91
|
-
vertical-align: middle;
|
92
|
-
}
|
93
|
-
|
94
|
-
.home {
|
95
|
-
display: flex;
|
96
|
-
flex-direction: column;
|
97
|
-
justify-content: space-between;
|
98
|
-
align-items: center;
|
99
|
-
height: 100vh;
|
100
|
-
padding: 45px;
|
101
|
-
max-width: 1024px;
|
102
|
-
margin: 0 auto;
|
103
|
-
overflow: hidden;
|
104
|
-
|
105
|
-
@media (max-width: 400px) {
|
106
|
-
padding: 24px;
|
107
|
-
}
|
108
|
-
|
109
|
-
.content {
|
110
|
-
display: flex;
|
111
|
-
flex-direction: column;
|
112
|
-
align-items: center;
|
113
|
-
justify-content: center;
|
114
|
-
flex-grow: 1;
|
115
|
-
|
116
|
-
h1 {
|
117
|
-
text-align: center;
|
118
|
-
}
|
119
|
-
}
|
120
|
-
|
121
|
-
.links {
|
122
|
-
display: flex;
|
123
|
-
align-items: center;
|
124
|
-
gap: 12px;
|
125
|
-
|
126
|
-
a {
|
127
|
-
text-decoration: none;
|
128
|
-
padding: 0.25rem 0.5rem;
|
129
|
-
border-radius: 4px;
|
130
|
-
}
|
131
|
-
|
132
|
-
.admin {
|
133
|
-
color: rgb(0, 0, 0);
|
134
|
-
background: rgb(1000, 1000, 1000);
|
135
|
-
border: 1px solid rgb(0, 0, 0);
|
136
|
-
}
|
137
|
-
|
138
|
-
.docs {
|
139
|
-
color: rgb(1000, 1000, 1000);
|
140
|
-
background: rgb(0, 0, 0);
|
141
|
-
border: 1px solid rgb(1000, 1000, 1000);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
.footer {
|
146
|
-
display: flex;
|
147
|
-
align-items: center;
|
148
|
-
gap: 8px;
|
149
|
-
|
150
|
-
@media (max-width: 1024px) {
|
151
|
-
flex-direction: column;
|
152
|
-
gap: 6px;
|
153
|
-
}
|
154
|
-
|
155
|
-
p {
|
156
|
-
margin: 0;
|
157
|
-
}
|
158
|
-
|
159
|
-
.codeLink {
|
160
|
-
text-decoration: none;
|
161
|
-
padding: 0 0.5rem;
|
162
|
-
background: rgb(60, 60, 60);
|
163
|
-
border-radius: 4px;
|
164
|
-
}
|
165
|
-
}
|
166
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import type { Metadata } from "next"
|
2
|
-
|
3
|
-
import "./globals.css"
|
4
|
-
|
5
|
-
export const metadata: Metadata = {
|
6
|
-
description: "A blank template using Payload in a Next.js app.",
|
7
|
-
title: "Payload Blank Template",
|
8
|
-
}
|
9
|
-
|
10
|
-
export default function RootLayout({
|
11
|
-
children,
|
12
|
-
}: Readonly<{
|
13
|
-
children: React.ReactNode
|
14
|
-
}>) {
|
15
|
-
return (
|
16
|
-
<html lang="en">
|
17
|
-
<body className="antialiased">{children}</body>
|
18
|
-
</html>
|
19
|
-
)
|
20
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import { PrismaAdapter } from "@auth/prisma-adapter"
|
2
|
-
import { type DefaultSession, type NextAuthOptions } from "next-auth"
|
3
|
-
import DiscordProvider from "next-auth/providers/discord"
|
4
|
-
|
5
|
-
import { env } from "@/env"
|
6
|
-
import { db } from "@/server/db"
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Module augmentation for `next-auth` types. Allows us to add custom properties to the `session`
|
10
|
-
* object and keep type safety.
|
11
|
-
*
|
12
|
-
* @see https://next-auth.js.org/getting-started/typescript#module-augmentation
|
13
|
-
*/
|
14
|
-
declare module "next-auth" {
|
15
|
-
interface Session extends DefaultSession {
|
16
|
-
user: {
|
17
|
-
id: string
|
18
|
-
// ...other properties
|
19
|
-
// role: UserRole;
|
20
|
-
} & DefaultSession["user"]
|
21
|
-
}
|
22
|
-
|
23
|
-
// interface User {
|
24
|
-
// // ...other properties
|
25
|
-
// // role: UserRole;
|
26
|
-
// }
|
27
|
-
}
|
28
|
-
|
29
|
-
/**
|
30
|
-
* Options for NextAuth.js used to configure adapters, providers, callbacks, etc.
|
31
|
-
*
|
32
|
-
* @see https://next-auth.js.org/configuration/options
|
33
|
-
*/
|
34
|
-
export const authConfig = {
|
35
|
-
providers: [
|
36
|
-
DiscordProvider({
|
37
|
-
clientId: env.DISCORD_CLIENT_ID,
|
38
|
-
clientSecret: env.DISCORD_CLIENT_SECRET,
|
39
|
-
}),
|
40
|
-
/**
|
41
|
-
* ...add more providers here.
|
42
|
-
*
|
43
|
-
* Most other providers require a bit more work than the Discord provider. For example, the
|
44
|
-
* GitHub provider requires you to add the `refresh_token_expires_in` field to the Account
|
45
|
-
* model. Refer to the NextAuth.js docs for the provider you want to use. Example:
|
46
|
-
*
|
47
|
-
* @see https://next-auth.js.org/providers/github
|
48
|
-
*/
|
49
|
-
],
|
50
|
-
adapter: PrismaAdapter(db),
|
51
|
-
callbacks: {
|
52
|
-
session: ({ session, user }) => ({
|
53
|
-
...session,
|
54
|
-
user: {
|
55
|
-
...session.user,
|
56
|
-
id: user.id,
|
57
|
-
},
|
58
|
-
}),
|
59
|
-
},
|
60
|
-
} satisfies NextAuthOptions
|
@@ -1,57 +0,0 @@
|
|
1
|
-
import { type DefaultSession, type NextAuthOptions } from "next-auth"
|
2
|
-
import DiscordProvider from "next-auth/providers/discord"
|
3
|
-
|
4
|
-
import { env } from "@/env"
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Module augmentation for `next-auth` types. Allows us to add custom properties to the `session`
|
8
|
-
* object and keep type safety.
|
9
|
-
*
|
10
|
-
* @see https://next-auth.js.org/getting-started/typescript#module-augmentation
|
11
|
-
*/
|
12
|
-
declare module "next-auth" {
|
13
|
-
interface Session extends DefaultSession {
|
14
|
-
user: {
|
15
|
-
id: string
|
16
|
-
// ...other properties
|
17
|
-
// role: UserRole;
|
18
|
-
} & DefaultSession["user"]
|
19
|
-
}
|
20
|
-
|
21
|
-
// interface User {
|
22
|
-
// // ...other properties
|
23
|
-
// // role: UserRole;
|
24
|
-
// }
|
25
|
-
}
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Options for NextAuth.js used to configure adapters, providers, callbacks, etc.
|
29
|
-
*
|
30
|
-
* @see https://next-auth.js.org/configuration/options
|
31
|
-
*/
|
32
|
-
export const authConfig = {
|
33
|
-
providers: [
|
34
|
-
DiscordProvider({
|
35
|
-
clientId: env.DISCORD_CLIENT_ID,
|
36
|
-
clientSecret: env.DISCORD_CLIENT_SECRET,
|
37
|
-
}),
|
38
|
-
/**
|
39
|
-
* ...add more providers here.
|
40
|
-
*
|
41
|
-
* Most other providers require a bit more work than the Discord provider. For example, the
|
42
|
-
* GitHub provider requires you to add the `refresh_token_expires_in` field to the Account
|
43
|
-
* model. Refer to the NextAuth.js docs for the provider you want to use. Example:
|
44
|
-
*
|
45
|
-
* @see https://next-auth.js.org/providers/github
|
46
|
-
*/
|
47
|
-
],
|
48
|
-
callbacks: {
|
49
|
-
session: ({ session, token }) => ({
|
50
|
-
...session,
|
51
|
-
user: {
|
52
|
-
...session.user,
|
53
|
-
id: token.sub,
|
54
|
-
},
|
55
|
-
}),
|
56
|
-
},
|
57
|
-
} satisfies NextAuthOptions
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import NextAuth from "next-auth"
|
2
|
-
import { cache } from "react"
|
3
|
-
|
4
|
-
import { authConfig } from "./config"
|
5
|
-
|
6
|
-
const { auth: uncachedAuth, handlers, signIn, signOut } = NextAuth(authConfig)
|
7
|
-
|
8
|
-
const auth = cache(uncachedAuth)
|
9
|
-
|
10
|
-
export { auth, handlers, signIn, signOut }
|
File without changes
|
File without changes
|