create-croissant 0.1.16 → 0.1.18

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.1.16",
6
+ "version": "0.1.18",
7
7
  "description": "Scaffold a new project using the Croissant Stack",
8
8
  "repository": {
9
9
  "type": "git",
@@ -50,15 +50,11 @@ const data = {
50
50
  }
51
51
 
52
52
  export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
53
- const [user, setUser] = React.useState<typeof authClient.$Infer.Session.user | null>(null)
53
+ const {
54
+ data: session,
55
+ } = authClient.useSession()
54
56
 
55
- React.useEffect(() => {
56
- const checkSession = async () => {
57
- const { data: sessionData } = await authClient.getSession()
58
- setUser(sessionData?.user || null)
59
- }
60
- checkSession()
61
- }, [])
57
+ const user = session?.user || null
62
58
 
63
59
  return (
64
60
  <Sidebar {...props}>
@@ -1,3 +1,3 @@
1
- import { createAuthClient } from "better-auth/client";
1
+ import { createAuthClient } from "better-auth/react";
2
2
 
3
3
  export const authClient = createAuthClient();
@@ -9,41 +9,21 @@
9
9
  // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
10
 
11
11
  import { Route as rootRouteImport } from './routes/__root'
12
- import { Route as SignupRouteImport } from './routes/signup'
13
- import { Route as LoginRouteImport } from './routes/login'
14
- import { Route as DashboardRouteImport } from './routes/dashboard'
15
- import { Route as AccountRouteImport } from './routes/account'
16
- import { Route as IndexRouteImport } from './routes/index'
12
+ import { Route as publicIndexRouteImport } from './routes/(public)/index'
17
13
  import { Route as ExamplesSsrOrpcAuthRouteImport } from './routes/examples/ssr-orpc-auth'
18
14
  import { Route as ExamplesSsrOrpcRouteImport } from './routes/examples/ssr-orpc'
19
15
  import { Route as ExamplesIsrRouteImport } from './routes/examples/isr'
20
16
  import { Route as ExamplesClientOrpcAuthRouteImport } from './routes/examples/client-orpc-auth'
21
17
  import { Route as ExamplesClientOrpcRouteImport } from './routes/examples/client-orpc'
18
+ import { Route as publicSignupRouteImport } from './routes/(public)/signup'
19
+ import { Route as publicLoginRouteImport } from './routes/(public)/login'
20
+ import { Route as authDashboardRouteImport } from './routes/(auth)/dashboard'
21
+ import { Route as authAccountRouteImport } from './routes/(auth)/account'
22
22
  import { Route as ApiRpcSplatRouteImport } from './routes/api/rpc.$'
23
23
  import { Route as ApiAuthSplatRouteImport } from './routes/api/auth/$'
24
24
 
25
- const SignupRoute = SignupRouteImport.update({
26
- id: '/signup',
27
- path: '/signup',
28
- getParentRoute: () => rootRouteImport,
29
- } as any)
30
- const LoginRoute = LoginRouteImport.update({
31
- id: '/login',
32
- path: '/login',
33
- getParentRoute: () => rootRouteImport,
34
- } as any)
35
- const DashboardRoute = DashboardRouteImport.update({
36
- id: '/dashboard',
37
- path: '/dashboard',
38
- getParentRoute: () => rootRouteImport,
39
- } as any)
40
- const AccountRoute = AccountRouteImport.update({
41
- id: '/account',
42
- path: '/account',
43
- getParentRoute: () => rootRouteImport,
44
- } as any)
45
- const IndexRoute = IndexRouteImport.update({
46
- id: '/',
25
+ const publicIndexRoute = publicIndexRouteImport.update({
26
+ id: '/(public)/',
47
27
  path: '/',
48
28
  getParentRoute: () => rootRouteImport,
49
29
  } as any)
@@ -72,6 +52,26 @@ const ExamplesClientOrpcRoute = ExamplesClientOrpcRouteImport.update({
72
52
  path: '/examples/client-orpc',
73
53
  getParentRoute: () => rootRouteImport,
74
54
  } as any)
55
+ const publicSignupRoute = publicSignupRouteImport.update({
56
+ id: '/(public)/signup',
57
+ path: '/signup',
58
+ getParentRoute: () => rootRouteImport,
59
+ } as any)
60
+ const publicLoginRoute = publicLoginRouteImport.update({
61
+ id: '/(public)/login',
62
+ path: '/login',
63
+ getParentRoute: () => rootRouteImport,
64
+ } as any)
65
+ const authDashboardRoute = authDashboardRouteImport.update({
66
+ id: '/(auth)/dashboard',
67
+ path: '/dashboard',
68
+ getParentRoute: () => rootRouteImport,
69
+ } as any)
70
+ const authAccountRoute = authAccountRouteImport.update({
71
+ id: '/(auth)/account',
72
+ path: '/account',
73
+ getParentRoute: () => rootRouteImport,
74
+ } as any)
75
75
  const ApiRpcSplatRoute = ApiRpcSplatRouteImport.update({
76
76
  id: '/api/rpc/$',
77
77
  path: '/api/rpc/$',
@@ -84,52 +84,51 @@ const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
84
84
  } as any)
85
85
 
86
86
  export interface FileRoutesByFullPath {
87
- '/': typeof IndexRoute
88
- '/account': typeof AccountRoute
89
- '/dashboard': typeof DashboardRoute
90
- '/login': typeof LoginRoute
91
- '/signup': typeof SignupRoute
87
+ '/account': typeof authAccountRoute
88
+ '/dashboard': typeof authDashboardRoute
89
+ '/login': typeof publicLoginRoute
90
+ '/signup': typeof publicSignupRoute
92
91
  '/examples/client-orpc': typeof ExamplesClientOrpcRoute
93
92
  '/examples/client-orpc-auth': typeof ExamplesClientOrpcAuthRoute
94
93
  '/examples/isr': typeof ExamplesIsrRoute
95
94
  '/examples/ssr-orpc': typeof ExamplesSsrOrpcRoute
96
95
  '/examples/ssr-orpc-auth': typeof ExamplesSsrOrpcAuthRoute
96
+ '/': typeof publicIndexRoute
97
97
  '/api/auth/$': typeof ApiAuthSplatRoute
98
98
  '/api/rpc/$': typeof ApiRpcSplatRoute
99
99
  }
100
100
  export interface FileRoutesByTo {
101
- '/': typeof IndexRoute
102
- '/account': typeof AccountRoute
103
- '/dashboard': typeof DashboardRoute
104
- '/login': typeof LoginRoute
105
- '/signup': typeof SignupRoute
101
+ '/account': typeof authAccountRoute
102
+ '/dashboard': typeof authDashboardRoute
103
+ '/login': typeof publicLoginRoute
104
+ '/signup': typeof publicSignupRoute
106
105
  '/examples/client-orpc': typeof ExamplesClientOrpcRoute
107
106
  '/examples/client-orpc-auth': typeof ExamplesClientOrpcAuthRoute
108
107
  '/examples/isr': typeof ExamplesIsrRoute
109
108
  '/examples/ssr-orpc': typeof ExamplesSsrOrpcRoute
110
109
  '/examples/ssr-orpc-auth': typeof ExamplesSsrOrpcAuthRoute
110
+ '/': typeof publicIndexRoute
111
111
  '/api/auth/$': typeof ApiAuthSplatRoute
112
112
  '/api/rpc/$': typeof ApiRpcSplatRoute
113
113
  }
114
114
  export interface FileRoutesById {
115
115
  __root__: typeof rootRouteImport
116
- '/': typeof IndexRoute
117
- '/account': typeof AccountRoute
118
- '/dashboard': typeof DashboardRoute
119
- '/login': typeof LoginRoute
120
- '/signup': typeof SignupRoute
116
+ '/(auth)/account': typeof authAccountRoute
117
+ '/(auth)/dashboard': typeof authDashboardRoute
118
+ '/(public)/login': typeof publicLoginRoute
119
+ '/(public)/signup': typeof publicSignupRoute
121
120
  '/examples/client-orpc': typeof ExamplesClientOrpcRoute
122
121
  '/examples/client-orpc-auth': typeof ExamplesClientOrpcAuthRoute
123
122
  '/examples/isr': typeof ExamplesIsrRoute
124
123
  '/examples/ssr-orpc': typeof ExamplesSsrOrpcRoute
125
124
  '/examples/ssr-orpc-auth': typeof ExamplesSsrOrpcAuthRoute
125
+ '/(public)/': typeof publicIndexRoute
126
126
  '/api/auth/$': typeof ApiAuthSplatRoute
127
127
  '/api/rpc/$': typeof ApiRpcSplatRoute
128
128
  }
129
129
  export interface FileRouteTypes {
130
130
  fileRoutesByFullPath: FileRoutesByFullPath
131
131
  fullPaths:
132
- | '/'
133
132
  | '/account'
134
133
  | '/dashboard'
135
134
  | '/login'
@@ -139,11 +138,11 @@ export interface FileRouteTypes {
139
138
  | '/examples/isr'
140
139
  | '/examples/ssr-orpc'
141
140
  | '/examples/ssr-orpc-auth'
141
+ | '/'
142
142
  | '/api/auth/$'
143
143
  | '/api/rpc/$'
144
144
  fileRoutesByTo: FileRoutesByTo
145
145
  to:
146
- | '/'
147
146
  | '/account'
148
147
  | '/dashboard'
149
148
  | '/login'
@@ -153,74 +152,47 @@ export interface FileRouteTypes {
153
152
  | '/examples/isr'
154
153
  | '/examples/ssr-orpc'
155
154
  | '/examples/ssr-orpc-auth'
155
+ | '/'
156
156
  | '/api/auth/$'
157
157
  | '/api/rpc/$'
158
158
  id:
159
159
  | '__root__'
160
- | '/'
161
- | '/account'
162
- | '/dashboard'
163
- | '/login'
164
- | '/signup'
160
+ | '/(auth)/account'
161
+ | '/(auth)/dashboard'
162
+ | '/(public)/login'
163
+ | '/(public)/signup'
165
164
  | '/examples/client-orpc'
166
165
  | '/examples/client-orpc-auth'
167
166
  | '/examples/isr'
168
167
  | '/examples/ssr-orpc'
169
168
  | '/examples/ssr-orpc-auth'
169
+ | '/(public)/'
170
170
  | '/api/auth/$'
171
171
  | '/api/rpc/$'
172
172
  fileRoutesById: FileRoutesById
173
173
  }
174
174
  export interface RootRouteChildren {
175
- IndexRoute: typeof IndexRoute
176
- AccountRoute: typeof AccountRoute
177
- DashboardRoute: typeof DashboardRoute
178
- LoginRoute: typeof LoginRoute
179
- SignupRoute: typeof SignupRoute
175
+ authAccountRoute: typeof authAccountRoute
176
+ authDashboardRoute: typeof authDashboardRoute
177
+ publicLoginRoute: typeof publicLoginRoute
178
+ publicSignupRoute: typeof publicSignupRoute
180
179
  ExamplesClientOrpcRoute: typeof ExamplesClientOrpcRoute
181
180
  ExamplesClientOrpcAuthRoute: typeof ExamplesClientOrpcAuthRoute
182
181
  ExamplesIsrRoute: typeof ExamplesIsrRoute
183
182
  ExamplesSsrOrpcRoute: typeof ExamplesSsrOrpcRoute
184
183
  ExamplesSsrOrpcAuthRoute: typeof ExamplesSsrOrpcAuthRoute
184
+ publicIndexRoute: typeof publicIndexRoute
185
185
  ApiAuthSplatRoute: typeof ApiAuthSplatRoute
186
186
  ApiRpcSplatRoute: typeof ApiRpcSplatRoute
187
187
  }
188
188
 
189
189
  declare module '@tanstack/react-router' {
190
190
  interface FileRoutesByPath {
191
- '/signup': {
192
- id: '/signup'
193
- path: '/signup'
194
- fullPath: '/signup'
195
- preLoaderRoute: typeof SignupRouteImport
196
- parentRoute: typeof rootRouteImport
197
- }
198
- '/login': {
199
- id: '/login'
200
- path: '/login'
201
- fullPath: '/login'
202
- preLoaderRoute: typeof LoginRouteImport
203
- parentRoute: typeof rootRouteImport
204
- }
205
- '/dashboard': {
206
- id: '/dashboard'
207
- path: '/dashboard'
208
- fullPath: '/dashboard'
209
- preLoaderRoute: typeof DashboardRouteImport
210
- parentRoute: typeof rootRouteImport
211
- }
212
- '/account': {
213
- id: '/account'
214
- path: '/account'
215
- fullPath: '/account'
216
- preLoaderRoute: typeof AccountRouteImport
217
- parentRoute: typeof rootRouteImport
218
- }
219
- '/': {
220
- id: '/'
191
+ '/(public)/': {
192
+ id: '/(public)/'
221
193
  path: '/'
222
194
  fullPath: '/'
223
- preLoaderRoute: typeof IndexRouteImport
195
+ preLoaderRoute: typeof publicIndexRouteImport
224
196
  parentRoute: typeof rootRouteImport
225
197
  }
226
198
  '/examples/ssr-orpc-auth': {
@@ -258,6 +230,34 @@ declare module '@tanstack/react-router' {
258
230
  preLoaderRoute: typeof ExamplesClientOrpcRouteImport
259
231
  parentRoute: typeof rootRouteImport
260
232
  }
233
+ '/(public)/signup': {
234
+ id: '/(public)/signup'
235
+ path: '/signup'
236
+ fullPath: '/signup'
237
+ preLoaderRoute: typeof publicSignupRouteImport
238
+ parentRoute: typeof rootRouteImport
239
+ }
240
+ '/(public)/login': {
241
+ id: '/(public)/login'
242
+ path: '/login'
243
+ fullPath: '/login'
244
+ preLoaderRoute: typeof publicLoginRouteImport
245
+ parentRoute: typeof rootRouteImport
246
+ }
247
+ '/(auth)/dashboard': {
248
+ id: '/(auth)/dashboard'
249
+ path: '/dashboard'
250
+ fullPath: '/dashboard'
251
+ preLoaderRoute: typeof authDashboardRouteImport
252
+ parentRoute: typeof rootRouteImport
253
+ }
254
+ '/(auth)/account': {
255
+ id: '/(auth)/account'
256
+ path: '/account'
257
+ fullPath: '/account'
258
+ preLoaderRoute: typeof authAccountRouteImport
259
+ parentRoute: typeof rootRouteImport
260
+ }
261
261
  '/api/rpc/$': {
262
262
  id: '/api/rpc/$'
263
263
  path: '/api/rpc/$'
@@ -276,16 +276,16 @@ declare module '@tanstack/react-router' {
276
276
  }
277
277
 
278
278
  const rootRouteChildren: RootRouteChildren = {
279
- IndexRoute: IndexRoute,
280
- AccountRoute: AccountRoute,
281
- DashboardRoute: DashboardRoute,
282
- LoginRoute: LoginRoute,
283
- SignupRoute: SignupRoute,
279
+ authAccountRoute: authAccountRoute,
280
+ authDashboardRoute: authDashboardRoute,
281
+ publicLoginRoute: publicLoginRoute,
282
+ publicSignupRoute: publicSignupRoute,
284
283
  ExamplesClientOrpcRoute: ExamplesClientOrpcRoute,
285
284
  ExamplesClientOrpcAuthRoute: ExamplesClientOrpcAuthRoute,
286
285
  ExamplesIsrRoute: ExamplesIsrRoute,
287
286
  ExamplesSsrOrpcRoute: ExamplesSsrOrpcRoute,
288
287
  ExamplesSsrOrpcAuthRoute: ExamplesSsrOrpcAuthRoute,
288
+ publicIndexRoute: publicIndexRoute,
289
289
  ApiAuthSplatRoute: ApiAuthSplatRoute,
290
290
  ApiRpcSplatRoute: ApiRpcSplatRoute,
291
291
  }
@@ -28,7 +28,7 @@ const passwordSchema = z.object({
28
28
  path: ["confirmPassword"],
29
29
  })
30
30
 
31
- export const Route = createFileRoute("/account")({
31
+ export const Route = createFileRoute("/(auth)/account")({
32
32
  beforeLoad: async () => {
33
33
  const session = await getSessionFn()
34
34
  if (!session) {
@@ -3,7 +3,7 @@ import { getSessionFn } from "@/lib/auth-utils"
3
3
  import { authClient } from "@/lib/auth-client"
4
4
  import { orpc } from "@/lib/orpc"
5
5
 
6
- export const Route = createFileRoute("/dashboard")({
6
+ export const Route = createFileRoute("/(auth)/dashboard")({
7
7
  beforeLoad: async () => {
8
8
  const session = await getSessionFn()
9
9
  if (!session) {
@@ -7,7 +7,7 @@ import { orpc } from "@/lib/orpc"
7
7
  type Outputs = InferRouterOutputs<typeof router>
8
8
  type Planet = Outputs["planets"]["getPlanets"][number]
9
9
 
10
- export const Route = createFileRoute("/")({
10
+ export const Route = createFileRoute("/(public)/")({
11
11
  loader: async () => {
12
12
  const [helloRes, planets] = await Promise.all([
13
13
  orpc.hello({ name: "TanStack Start" }),
@@ -1,7 +1,7 @@
1
1
  import { createFileRoute } from "@tanstack/react-router"
2
2
  import { LoginForm } from "@/components/login-form"
3
3
 
4
- export const Route = createFileRoute("/login")({
4
+ export const Route = createFileRoute("/(public)/login")({
5
5
  component: Login,
6
6
  })
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { createFileRoute } from "@tanstack/react-router"
2
2
  import { SignupForm } from "@/components/signup-form"
3
3
 
4
- export const Route = createFileRoute("/signup")({
4
+ export const Route = createFileRoute("/(public)/signup")({
5
5
  component: Signup,
6
6
  })
7
7
 
@@ -1,19 +0,0 @@
1
- import * as React from "react"
2
-
3
- const MOBILE_BREAKPOINT = 768
4
-
5
- export function useIsMobile() {
6
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
7
-
8
- React.useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
12
- }
13
- mql.addEventListener("change", onChange)
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
15
- return () => mql.removeEventListener("change", onChange)
16
- }, [])
17
-
18
- return !!isMobile
19
- }