create-better-t-stack 2.15.2 → 2.16.1
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/dist/index.js +11 -14
- package/package.json +1 -1
- package/templates/api/orpc/native/utils/orpc.ts.hbs +2 -16
- package/templates/api/orpc/server/base/src/lib/orpc.ts.hbs +0 -1
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +2 -2
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +2 -17
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +2 -2
- package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +2 -2
- package/templates/auth/web/nuxt/app/components/SignInForm.vue +1 -1
- package/templates/auth/web/nuxt/app/components/SignUpForm.vue +1 -1
- package/templates/auth/web/react/next/src/components/sign-in-form.tsx +1 -1
- package/templates/auth/web/react/next/src/components/sign-up-form.tsx +1 -1
- package/templates/auth/web/react/react-router/src/components/sign-in-form.tsx +1 -1
- package/templates/auth/web/react/react-router/src/components/sign-up-form.tsx +1 -1
- package/templates/auth/web/react/tanstack-router/src/components/sign-in-form.tsx +1 -1
- package/templates/auth/web/react/tanstack-router/src/components/sign-up-form.tsx +1 -1
- package/templates/auth/web/react/tanstack-start/src/components/sign-in-form.tsx +1 -1
- package/templates/auth/web/react/tanstack-start/src/components/sign-up-form.tsx +1 -1
- package/templates/auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +1 -2
- package/templates/auth/web/solid/src/components/sign-in-form.tsx +1 -1
- package/templates/auth/web/solid/src/components/sign-up-form.tsx +1 -1
- package/templates/auth/web/svelte/src/components/SignInForm.svelte +1 -1
- package/templates/auth/web/svelte/src/components/SignUpForm.svelte +1 -1
- package/templates/examples/todo/native/nativewind/app/(drawer)/todos.tsx.hbs +4 -4
- package/templates/examples/todo/native/unistyles/app/(drawer)/todos.tsx.hbs +5 -5
- package/templates/examples/todo/web/react/next/src/app/todos/page.tsx.hbs +4 -4
- package/templates/examples/todo/web/react/react-router/src/routes/todos.tsx.hbs +4 -4
- package/templates/examples/todo/web/react/tanstack-router/src/routes/todos.tsx.hbs +4 -4
- package/templates/examples/todo/web/react/tanstack-start/src/routes/todos.tsx.hbs +10 -11
- package/templates/examples/todo/web/solid/src/routes/{todos.tsx → todos.tsx.hbs} +2 -2
- package/templates/examples/todo/web/svelte/src/routes/todos/+page.svelte.hbs +2 -42
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +32 -30
- package/templates/frontend/react/react-router/src/root.tsx.hbs +54 -56
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +2 -4
- package/templates/frontend/react/tanstack-start/package.json +12 -12
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +3 -6
- package/templates/frontend/react/tanstack-start/src/routes/index.tsx.hbs +1 -2
- package/templates/frontend/solid/package.json +0 -6
package/dist/index.js
CHANGED
|
@@ -86,12 +86,9 @@ const dependencyVersionMap = {
|
|
|
86
86
|
"@ai-sdk/svelte": "^2.1.9",
|
|
87
87
|
"@ai-sdk/react": "^1.2.12",
|
|
88
88
|
"@prisma/extension-accelerate": "^1.3.0",
|
|
89
|
-
"@orpc/server": "^1.
|
|
90
|
-
"@orpc/client": "^1.
|
|
91
|
-
"@orpc/
|
|
92
|
-
"@orpc/solid-query": "^1.2.0",
|
|
93
|
-
"@orpc/vue-query": "^1.2.0",
|
|
94
|
-
"@orpc/svelte-query": "^1.2.0",
|
|
89
|
+
"@orpc/server": "^1.4.1",
|
|
90
|
+
"@orpc/client": "^1.4.1",
|
|
91
|
+
"@orpc/tanstack-query": "^1.4.1",
|
|
95
92
|
"@trpc/tanstack-react-query": "^11.0.0",
|
|
96
93
|
"@trpc/server": "^11.0.0",
|
|
97
94
|
"@trpc/client": "^11.0.0",
|
|
@@ -99,8 +96,8 @@ const dependencyVersionMap = {
|
|
|
99
96
|
"@convex-dev/react-query": "^0.0.0-alpha.8",
|
|
100
97
|
"convex-svelte": "^0.0.11",
|
|
101
98
|
"@tanstack/svelte-query": "^5.74.4",
|
|
102
|
-
"@tanstack/react-query-devtools": "^5.
|
|
103
|
-
"@tanstack/react-query": "^5.
|
|
99
|
+
"@tanstack/react-query-devtools": "^5.80.5",
|
|
100
|
+
"@tanstack/react-query": "^5.80.5",
|
|
104
101
|
"@tanstack/solid-query": "^5.75.0",
|
|
105
102
|
"@tanstack/solid-query-devtools": "^5.75.0"
|
|
106
103
|
};
|
|
@@ -499,7 +496,7 @@ async function setupApi(config) {
|
|
|
499
496
|
if (hasReactWeb) {
|
|
500
497
|
if (api === "orpc") await addPackageDependency({
|
|
501
498
|
dependencies: [
|
|
502
|
-
"@orpc/
|
|
499
|
+
"@orpc/tanstack-query",
|
|
503
500
|
"@orpc/client",
|
|
504
501
|
"@orpc/server"
|
|
505
502
|
],
|
|
@@ -516,7 +513,7 @@ async function setupApi(config) {
|
|
|
516
513
|
} else if (hasNuxtWeb) {
|
|
517
514
|
if (api === "orpc") await addPackageDependency({
|
|
518
515
|
dependencies: [
|
|
519
|
-
"@orpc/
|
|
516
|
+
"@orpc/tanstack-query",
|
|
520
517
|
"@orpc/client",
|
|
521
518
|
"@orpc/server"
|
|
522
519
|
],
|
|
@@ -525,7 +522,7 @@ async function setupApi(config) {
|
|
|
525
522
|
} else if (hasSvelteWeb) {
|
|
526
523
|
if (api === "orpc") await addPackageDependency({
|
|
527
524
|
dependencies: [
|
|
528
|
-
"@orpc/
|
|
525
|
+
"@orpc/tanstack-query",
|
|
529
526
|
"@orpc/client",
|
|
530
527
|
"@orpc/server",
|
|
531
528
|
"@tanstack/svelte-query"
|
|
@@ -535,7 +532,7 @@ async function setupApi(config) {
|
|
|
535
532
|
} else if (hasSolidWeb) {
|
|
536
533
|
if (api === "orpc") await addPackageDependency({
|
|
537
534
|
dependencies: [
|
|
538
|
-
"@orpc/
|
|
535
|
+
"@orpc/tanstack-query",
|
|
539
536
|
"@orpc/client",
|
|
540
537
|
"@orpc/server",
|
|
541
538
|
"@tanstack/solid-query"
|
|
@@ -555,7 +552,7 @@ async function setupApi(config) {
|
|
|
555
552
|
});
|
|
556
553
|
else if (api === "orpc") await addPackageDependency({
|
|
557
554
|
dependencies: [
|
|
558
|
-
"@orpc/
|
|
555
|
+
"@orpc/tanstack-query",
|
|
559
556
|
"@orpc/client",
|
|
560
557
|
"@orpc/server"
|
|
561
558
|
],
|
|
@@ -3484,7 +3481,7 @@ function processAndValidateFlags(options, projectName) {
|
|
|
3484
3481
|
if (options.api) {
|
|
3485
3482
|
config.api = options.api;
|
|
3486
3483
|
if (options.api === "none") {
|
|
3487
|
-
if (options.examples && !(options.examples.length === 1 && options.examples[0] === "none")) {
|
|
3484
|
+
if (options.examples && !(options.examples.length === 1 && options.examples[0] === "none") && options.backend !== "convex") {
|
|
3488
3485
|
consola$1.fatal("Cannot use '--examples' when '--api' is set to 'none'. Please remove the --examples flag or choose an API type.");
|
|
3489
3486
|
process.exit(1);
|
|
3490
3487
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.1",
|
|
4
4
|
"description": "A modern CLI tool for scaffolding end-to-end type-safe TypeScript projects with best practices and customizable configurations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { createORPCClient } from "@orpc/client";
|
|
2
2
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
|
-
import {
|
|
4
|
-
import type { RouterUtils } from "@orpc/react-query";
|
|
3
|
+
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
5
4
|
import type { RouterClient } from "@orpc/server";
|
|
6
5
|
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
|
7
|
-
import { createContext, useContext } from "react";
|
|
8
6
|
import type { appRouter } from "../../server/src/routers";
|
|
9
7
|
{{#if auth}}
|
|
10
8
|
import { authClient } from "@/lib/auth-client";
|
|
11
9
|
{{/if}}
|
|
12
10
|
|
|
13
|
-
type ORPCReactUtils = RouterUtils<RouterClient<typeof appRouter>>;
|
|
14
|
-
|
|
15
11
|
export const queryClient = new QueryClient({
|
|
16
12
|
queryCache: new QueryCache({
|
|
17
13
|
onError: (error) => {
|
|
@@ -36,14 +32,4 @@ export const link = new RPCLink({
|
|
|
36
32
|
|
|
37
33
|
export const client: RouterClient<typeof appRouter> = createORPCClient(link);
|
|
38
34
|
|
|
39
|
-
export const orpc =
|
|
40
|
-
|
|
41
|
-
export const ORPCContext = createContext<ORPCReactUtils | undefined>(undefined);
|
|
42
|
-
|
|
43
|
-
export function useORPC(): ORPCReactUtils {
|
|
44
|
-
const orpc = useContext(ORPCContext);
|
|
45
|
-
if (!orpc) {
|
|
46
|
-
throw new Error("ORPCContext is not set up properly");
|
|
47
|
-
}
|
|
48
|
-
return orpc;
|
|
49
|
-
}
|
|
35
|
+
export const orpc = createTanstackQueryUtils(client);
|
|
@@ -3,7 +3,7 @@ import type { RouterClient } from '@orpc/server'
|
|
|
3
3
|
import type { appRouter } from "../../../server/src/routers/index";
|
|
4
4
|
import { createORPCClient } from '@orpc/client'
|
|
5
5
|
import { RPCLink } from '@orpc/client/fetch'
|
|
6
|
-
import {
|
|
6
|
+
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
7
7
|
|
|
8
8
|
export default defineNuxtPlugin(() => {
|
|
9
9
|
const config = useRuntimeConfig()
|
|
@@ -25,7 +25,7 @@ export default defineNuxtPlugin(() => {
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
const client: RouterClient<typeof appRouter> = createORPCClient(rpcLink)
|
|
28
|
-
const orpcUtils =
|
|
28
|
+
const orpcUtils = createTanstackQueryUtils(client)
|
|
29
29
|
|
|
30
30
|
return {
|
|
31
31
|
provide: {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { createORPCClient } from "@orpc/client";
|
|
2
2
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
|
-
import {
|
|
3
|
+
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
4
4
|
import { QueryCache, QueryClient } from "@tanstack/react-query";
|
|
5
5
|
import { toast } from "sonner";
|
|
6
6
|
import type { appRouter } from "../../../server/src/routers/index";
|
|
7
7
|
import type { RouterClient } from "@orpc/server";
|
|
8
|
-
import { createContext, use } from 'react'
|
|
9
|
-
import type { RouterUtils } from '@orpc/react-query'
|
|
10
|
-
|
|
11
|
-
type ORPCReactUtils = RouterUtils<RouterClient<typeof appRouter>>
|
|
12
8
|
|
|
13
9
|
export const queryClient = new QueryClient({
|
|
14
10
|
queryCache: new QueryCache({
|
|
@@ -43,15 +39,4 @@ export const link = new RPCLink({
|
|
|
43
39
|
|
|
44
40
|
export const client: RouterClient<typeof appRouter> = createORPCClient(link)
|
|
45
41
|
|
|
46
|
-
export const orpc =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export const ORPCContext = createContext<ORPCReactUtils | undefined>(undefined)
|
|
50
|
-
|
|
51
|
-
export function useORPC(): ORPCReactUtils {
|
|
52
|
-
const orpc = use(ORPCContext)
|
|
53
|
-
if (!orpc) {
|
|
54
|
-
throw new Error('ORPCContext is not set up properly')
|
|
55
|
-
}
|
|
56
|
-
return orpc
|
|
57
|
-
}
|
|
42
|
+
export const orpc = createTanstackQueryUtils(client)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createORPCClient } from "@orpc/client";
|
|
2
2
|
import { RPCLink } from "@orpc/client/fetch";
|
|
3
|
-
import {
|
|
3
|
+
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
4
4
|
import { QueryCache, QueryClient } from "@tanstack/solid-query";
|
|
5
5
|
import type { appRouter } from "../../../server/src/routers/index";
|
|
6
6
|
import type { RouterClient } from "@orpc/server";
|
|
@@ -27,4 +27,4 @@ export const link = new RPCLink({
|
|
|
27
27
|
|
|
28
28
|
export const client: RouterClient<typeof appRouter> = createORPCClient(link);
|
|
29
29
|
|
|
30
|
-
export const orpc =
|
|
30
|
+
export const orpc = createTanstackQueryUtils(client);
|
|
@@ -2,7 +2,7 @@ import { PUBLIC_SERVER_URL } from "$env/static/public";
|
|
|
2
2
|
import { createORPCClient } from "@orpc/client";
|
|
3
3
|
import { RPCLink } from "@orpc/client/fetch";
|
|
4
4
|
import type { RouterClient } from "@orpc/server";
|
|
5
|
-
import {
|
|
5
|
+
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
6
6
|
import { QueryCache, QueryClient } from "@tanstack/svelte-query";
|
|
7
7
|
import type { appRouter } from "../../../server/src/routers/index";
|
|
8
8
|
|
|
@@ -28,4 +28,4 @@ export const link = new RPCLink({
|
|
|
28
28
|
|
|
29
29
|
export const client: RouterClient<typeof appRouter> = createORPCClient(link);
|
|
30
30
|
|
|
31
|
-
export const orpc =
|
|
31
|
+
export const orpc = createTanstackQueryUtils(client);
|
|
@@ -9,7 +9,7 @@ const toast = useToast()
|
|
|
9
9
|
const loading = ref(false)
|
|
10
10
|
|
|
11
11
|
const schema = z.object({
|
|
12
|
-
email: z.
|
|
12
|
+
email: z.email('Invalid email address'),
|
|
13
13
|
password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
14
14
|
})
|
|
15
15
|
|
|
@@ -10,7 +10,7 @@ const loading = ref(false)
|
|
|
10
10
|
|
|
11
11
|
const schema = z.object({
|
|
12
12
|
name: z.string().min(2, 'Name must be at least 2 characters'),
|
|
13
|
-
email: z.
|
|
13
|
+
email: z.email('Invalid email address'),
|
|
14
14
|
password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
15
15
|
})
|
|
16
16
|
|
|
@@ -40,7 +40,7 @@ export default function SignInForm({
|
|
|
40
40
|
},
|
|
41
41
|
validators: {
|
|
42
42
|
onSubmit: z.object({
|
|
43
|
-
email: z.
|
|
43
|
+
email: z.email("Invalid email address"),
|
|
44
44
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
45
45
|
}),
|
|
46
46
|
},
|
|
@@ -43,7 +43,7 @@ export default function SignUpForm({
|
|
|
43
43
|
validators: {
|
|
44
44
|
onSubmit: z.object({
|
|
45
45
|
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
46
|
-
email: z.
|
|
46
|
+
email: z.email("Invalid email address"),
|
|
47
47
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
48
48
|
}),
|
|
49
49
|
},
|
|
@@ -40,7 +40,7 @@ export default function SignInForm({
|
|
|
40
40
|
},
|
|
41
41
|
validators: {
|
|
42
42
|
onSubmit: z.object({
|
|
43
|
-
email: z.
|
|
43
|
+
email: z.email("Invalid email address"),
|
|
44
44
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
45
45
|
}),
|
|
46
46
|
},
|
|
@@ -43,7 +43,7 @@ export default function SignUpForm({
|
|
|
43
43
|
validators: {
|
|
44
44
|
onSubmit: z.object({
|
|
45
45
|
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
46
|
-
email: z.
|
|
46
|
+
email: z.email("Invalid email address"),
|
|
47
47
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
48
48
|
}),
|
|
49
49
|
},
|
|
@@ -44,7 +44,7 @@ export default function SignInForm({
|
|
|
44
44
|
},
|
|
45
45
|
validators: {
|
|
46
46
|
onSubmit: z.object({
|
|
47
|
-
email: z.
|
|
47
|
+
email: z.email("Invalid email address"),
|
|
48
48
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
49
49
|
}),
|
|
50
50
|
},
|
|
@@ -47,7 +47,7 @@ export default function SignUpForm({
|
|
|
47
47
|
validators: {
|
|
48
48
|
onSubmit: z.object({
|
|
49
49
|
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
50
|
-
email: z.
|
|
50
|
+
email: z.email("Invalid email address"),
|
|
51
51
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
52
52
|
}),
|
|
53
53
|
},
|
|
@@ -44,7 +44,7 @@ export default function SignInForm({
|
|
|
44
44
|
},
|
|
45
45
|
validators: {
|
|
46
46
|
onSubmit: z.object({
|
|
47
|
-
email: z.
|
|
47
|
+
email: z.email("Invalid email address"),
|
|
48
48
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
49
49
|
}),
|
|
50
50
|
},
|
|
@@ -47,7 +47,7 @@ export default function SignUpForm({
|
|
|
47
47
|
validators: {
|
|
48
48
|
onSubmit: z.object({
|
|
49
49
|
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
50
|
-
email: z.
|
|
50
|
+
email: z.email("Invalid email address"),
|
|
51
51
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
52
52
|
}),
|
|
53
53
|
},
|
|
@@ -3,7 +3,7 @@ import { authClient } from "@/lib/auth-client";
|
|
|
3
3
|
import { useTRPC } from "@/utils/trpc";
|
|
4
4
|
{{/if}}
|
|
5
5
|
{{#if (eq api "orpc")}}
|
|
6
|
-
import {
|
|
6
|
+
import { orpc } from "@/utils/orpc";
|
|
7
7
|
{{/if}}
|
|
8
8
|
import { useQuery } from "@tanstack/react-query";
|
|
9
9
|
import { createFileRoute } from "@tanstack/react-router";
|
|
@@ -19,7 +19,6 @@ function RouteComponent() {
|
|
|
19
19
|
const trpc = useTRPC();
|
|
20
20
|
{{/if}}
|
|
21
21
|
{{#if (eq api "orpc")}}
|
|
22
|
-
const orpc = useORPC();
|
|
23
22
|
{{/if}}
|
|
24
23
|
const { data: session, isPending } = authClient.useSession();
|
|
25
24
|
|
|
@@ -39,7 +39,7 @@ export default function SignInForm({
|
|
|
39
39
|
},
|
|
40
40
|
validators: {
|
|
41
41
|
onSubmit: z.object({
|
|
42
|
-
email: z.
|
|
42
|
+
email: z.email("Invalid email address"),
|
|
43
43
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
44
44
|
}),
|
|
45
45
|
},
|
|
@@ -42,7 +42,7 @@ export default function SignUpForm({
|
|
|
42
42
|
validators: {
|
|
43
43
|
onSubmit: z.object({
|
|
44
44
|
name: z.string().min(2, "Name must be at least 2 characters"),
|
|
45
|
-
email: z.
|
|
45
|
+
email: z.email("Invalid email address"),
|
|
46
46
|
password: z.string().min(8, "Password must be at least 8 characters"),
|
|
47
47
|
}),
|
|
48
48
|
},
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
let { switchToSignUp } = $props<{ switchToSignUp: () => void }>();
|
|
8
8
|
|
|
9
9
|
const validationSchema = z.object({
|
|
10
|
-
email: z.
|
|
10
|
+
email: z.email('Invalid email address'),
|
|
11
11
|
password: z.string().min(1, 'Password is required'),
|
|
12
12
|
});
|
|
13
13
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
const validationSchema = z.object({
|
|
10
10
|
name: z.string().min(2, 'Name must be at least 2 characters'),
|
|
11
|
-
email: z.
|
|
11
|
+
email: z.email('Invalid email address'),
|
|
12
12
|
password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -70,12 +70,12 @@ export default function TodosScreen() {
|
|
|
70
70
|
);
|
|
71
71
|
const toggleMutation = useMutation(
|
|
72
72
|
orpc.todo.toggle.mutationOptions({
|
|
73
|
-
onSuccess: () => todos.refetch(),
|
|
73
|
+
onSuccess: () => { todos.refetch() },
|
|
74
74
|
}),
|
|
75
75
|
);
|
|
76
76
|
const deleteMutation = useMutation(
|
|
77
77
|
orpc.todo.delete.mutationOptions({
|
|
78
|
-
onSuccess: () => todos.refetch(),
|
|
78
|
+
onSuccess: () => { todos.refetch() },
|
|
79
79
|
}),
|
|
80
80
|
);
|
|
81
81
|
{{/if}}
|
|
@@ -91,12 +91,12 @@ export default function TodosScreen() {
|
|
|
91
91
|
);
|
|
92
92
|
const toggleMutation = useMutation(
|
|
93
93
|
trpc.todo.toggle.mutationOptions({
|
|
94
|
-
onSuccess: () => todos.refetch(),
|
|
94
|
+
onSuccess: () => { todos.refetch() },
|
|
95
95
|
}),
|
|
96
96
|
);
|
|
97
97
|
const deleteMutation = useMutation(
|
|
98
98
|
trpc.todo.delete.mutationOptions({
|
|
99
|
-
onSuccess: () => todos.refetch(),
|
|
99
|
+
onSuccess: () => { todos.refetch() },
|
|
100
100
|
}),
|
|
101
101
|
);
|
|
102
102
|
{{/if}}
|
|
@@ -73,12 +73,12 @@ export default function TodosScreen() {
|
|
|
73
73
|
);
|
|
74
74
|
const toggleMutation = useMutation(
|
|
75
75
|
orpc.todo.toggle.mutationOptions({
|
|
76
|
-
onSuccess: () => todos.refetch(),
|
|
76
|
+
onSuccess: () => { todos.refetch() },
|
|
77
77
|
})
|
|
78
78
|
);
|
|
79
79
|
const deleteMutation = useMutation(
|
|
80
80
|
orpc.todo.delete.mutationOptions({
|
|
81
|
-
onSuccess: () => todos.refetch(),
|
|
81
|
+
onSuccess: () => { todos.refetch() },
|
|
82
82
|
})
|
|
83
83
|
);
|
|
84
84
|
{{/if}}
|
|
@@ -94,12 +94,12 @@ export default function TodosScreen() {
|
|
|
94
94
|
);
|
|
95
95
|
const toggleMutation = useMutation(
|
|
96
96
|
trpc.todo.toggle.mutationOptions({
|
|
97
|
-
onSuccess: () => todos.refetch(),
|
|
97
|
+
onSuccess: () => { todos.refetch() },
|
|
98
98
|
})
|
|
99
99
|
);
|
|
100
100
|
const deleteMutation = useMutation(
|
|
101
101
|
trpc.todo.delete.mutationOptions({
|
|
102
|
-
onSuccess: () => todos.refetch(),
|
|
102
|
+
onSuccess: () => { todos.refetch() },
|
|
103
103
|
})
|
|
104
104
|
);
|
|
105
105
|
{{/if}}
|
|
@@ -337,4 +337,4 @@ const styles = StyleSheet.create((theme) => ({
|
|
|
337
337
|
textDecorationLine: "line-through",
|
|
338
338
|
color: theme.colors.border,
|
|
339
339
|
},
|
|
340
|
-
}));
|
|
340
|
+
}));
|
|
@@ -65,12 +65,12 @@ export default function TodosPage() {
|
|
|
65
65
|
);
|
|
66
66
|
const toggleMutation = useMutation(
|
|
67
67
|
orpc.todo.toggle.mutationOptions({
|
|
68
|
-
onSuccess: () => todos.refetch(),
|
|
68
|
+
onSuccess: () => { todos.refetch() },
|
|
69
69
|
}),
|
|
70
70
|
);
|
|
71
71
|
const deleteMutation = useMutation(
|
|
72
72
|
orpc.todo.delete.mutationOptions({
|
|
73
|
-
onSuccess: () => todos.refetch(),
|
|
73
|
+
onSuccess: () => { todos.refetch() },
|
|
74
74
|
}),
|
|
75
75
|
);
|
|
76
76
|
{{/if}}
|
|
@@ -86,12 +86,12 @@ export default function TodosPage() {
|
|
|
86
86
|
);
|
|
87
87
|
const toggleMutation = useMutation(
|
|
88
88
|
trpc.todo.toggle.mutationOptions({
|
|
89
|
-
onSuccess: () => todos.refetch(),
|
|
89
|
+
onSuccess: () => { todos.refetch() },
|
|
90
90
|
}),
|
|
91
91
|
);
|
|
92
92
|
const deleteMutation = useMutation(
|
|
93
93
|
trpc.todo.delete.mutationOptions({
|
|
94
|
-
onSuccess: () => todos.refetch(),
|
|
94
|
+
onSuccess: () => { todos.refetch() },
|
|
95
95
|
}),
|
|
96
96
|
);
|
|
97
97
|
{{/if}}
|
|
@@ -62,12 +62,12 @@ export default function Todos() {
|
|
|
62
62
|
);
|
|
63
63
|
const toggleMutation = useMutation(
|
|
64
64
|
orpc.todo.toggle.mutationOptions({
|
|
65
|
-
onSuccess: () => todos.refetch(),
|
|
65
|
+
onSuccess: () => { todos.refetch() },
|
|
66
66
|
})
|
|
67
67
|
);
|
|
68
68
|
const deleteMutation = useMutation(
|
|
69
69
|
orpc.todo.delete.mutationOptions({
|
|
70
|
-
onSuccess: () => todos.refetch(),
|
|
70
|
+
onSuccess: () => { todos.refetch() },
|
|
71
71
|
})
|
|
72
72
|
);
|
|
73
73
|
{{/if}}
|
|
@@ -83,12 +83,12 @@ export default function Todos() {
|
|
|
83
83
|
);
|
|
84
84
|
const toggleMutation = useMutation(
|
|
85
85
|
trpc.todo.toggle.mutationOptions({
|
|
86
|
-
onSuccess: () => todos.refetch(),
|
|
86
|
+
onSuccess: () => { todos.refetch() },
|
|
87
87
|
})
|
|
88
88
|
);
|
|
89
89
|
const deleteMutation = useMutation(
|
|
90
90
|
trpc.todo.delete.mutationOptions({
|
|
91
|
-
onSuccess: () => todos.refetch(),
|
|
91
|
+
onSuccess: () => { todos.refetch() },
|
|
92
92
|
})
|
|
93
93
|
);
|
|
94
94
|
{{/if}}
|
|
@@ -67,12 +67,12 @@ function TodosRoute() {
|
|
|
67
67
|
);
|
|
68
68
|
const toggleMutation = useMutation(
|
|
69
69
|
orpc.todo.toggle.mutationOptions({
|
|
70
|
-
onSuccess: () => todos.refetch(),
|
|
70
|
+
onSuccess: () => { todos.refetch() },
|
|
71
71
|
}),
|
|
72
72
|
);
|
|
73
73
|
const deleteMutation = useMutation(
|
|
74
74
|
orpc.todo.delete.mutationOptions({
|
|
75
|
-
onSuccess: () => todos.refetch(),
|
|
75
|
+
onSuccess: () => { todos.refetch() },
|
|
76
76
|
}),
|
|
77
77
|
);
|
|
78
78
|
{{/if}}
|
|
@@ -88,12 +88,12 @@ function TodosRoute() {
|
|
|
88
88
|
);
|
|
89
89
|
const toggleMutation = useMutation(
|
|
90
90
|
trpc.todo.toggle.mutationOptions({
|
|
91
|
-
onSuccess: () => todos.refetch(),
|
|
91
|
+
onSuccess: () => { todos.refetch() },
|
|
92
92
|
}),
|
|
93
93
|
);
|
|
94
94
|
const deleteMutation = useMutation(
|
|
95
95
|
trpc.todo.delete.mutationOptions({
|
|
96
|
-
onSuccess: () => todos.refetch(),
|
|
96
|
+
onSuccess: () => { todos.refetch() },
|
|
97
97
|
}),
|
|
98
98
|
);
|
|
99
99
|
{{/if}}
|
|
@@ -17,14 +17,14 @@ import { useSuspenseQuery } from "@tanstack/react-query";
|
|
|
17
17
|
import { convexQuery } from "@convex-dev/react-query";
|
|
18
18
|
import { useMutation } from "convex/react";
|
|
19
19
|
import { api } from "@{{projectName}}/backend/convex/_generated/api";
|
|
20
|
-
import type { Id } from "@{{projectName}}/backend/convex/_generated/dataModel
|
|
20
|
+
import type { Id } from "@{{projectName}}/backend/convex/_generated/dataModel";
|
|
21
21
|
{{else}}
|
|
22
|
-
|
|
22
|
+
{{#if (eq api "trpc")}}
|
|
23
23
|
import { useTRPC } from "@/utils/trpc";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import {
|
|
27
|
-
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{#if (eq api "orpc")}}
|
|
26
|
+
import { orpc } from "@/utils/orpc";
|
|
27
|
+
{{/if}}
|
|
28
28
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
29
29
|
{{/if}}
|
|
30
30
|
|
|
@@ -77,7 +77,6 @@ function TodosRoute() {
|
|
|
77
77
|
const trpc = useTRPC();
|
|
78
78
|
{{/if}}
|
|
79
79
|
{{#if (eq api "orpc")}}
|
|
80
|
-
const orpc = useORPC();
|
|
81
80
|
{{/if}}
|
|
82
81
|
|
|
83
82
|
{{#if (eq api "trpc")}}
|
|
@@ -92,12 +91,12 @@ function TodosRoute() {
|
|
|
92
91
|
);
|
|
93
92
|
const toggleMutation = useMutation(
|
|
94
93
|
trpc.todo.toggle.mutationOptions({
|
|
95
|
-
onSuccess: () => todos.refetch(),
|
|
94
|
+
onSuccess: () => { todos.refetch() },
|
|
96
95
|
}),
|
|
97
96
|
);
|
|
98
97
|
const deleteMutation = useMutation(
|
|
99
98
|
trpc.todo.delete.mutationOptions({
|
|
100
|
-
onSuccess: () => todos.refetch(),
|
|
99
|
+
onSuccess: () => { todos.refetch() },
|
|
101
100
|
}),
|
|
102
101
|
);
|
|
103
102
|
{{/if}}
|
|
@@ -113,12 +112,12 @@ function TodosRoute() {
|
|
|
113
112
|
);
|
|
114
113
|
const toggleMutation = useMutation(
|
|
115
114
|
orpc.todo.toggle.mutationOptions({
|
|
116
|
-
onSuccess: () => todos.refetch(),
|
|
115
|
+
onSuccess: () => { todos.refetch() },
|
|
117
116
|
}),
|
|
118
117
|
);
|
|
119
118
|
const deleteMutation = useMutation(
|
|
120
119
|
orpc.todo.delete.mutationOptions({
|
|
121
|
-
onSuccess: () => todos.refetch(),
|
|
120
|
+
onSuccess: () => { todos.refetch() },
|
|
122
121
|
}),
|
|
123
122
|
);
|
|
124
123
|
{{/if}}
|
|
@@ -24,13 +24,13 @@ function TodosRoute() {
|
|
|
24
24
|
|
|
25
25
|
const toggleMutation = useMutation(() =>
|
|
26
26
|
orpc.todo.toggle.mutationOptions({
|
|
27
|
-
onSuccess: () => todos.refetch(),
|
|
27
|
+
onSuccess: () => { todos.refetch() },
|
|
28
28
|
}),
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const deleteMutation = useMutation(() =>
|
|
32
32
|
orpc.todo.delete.mutationOptions({
|
|
33
|
-
onSuccess: () => todos.refetch(),
|
|
33
|
+
onSuccess: () => { todos.refetch() },
|
|
34
34
|
}),
|
|
35
35
|
);
|
|
36
36
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<script lang="ts">
|
|
3
3
|
import { useQuery, useConvexClient } from 'convex-svelte';
|
|
4
4
|
import { api } from '@{{projectName}}/backend/convex/_generated/api';
|
|
5
|
-
import type { Id } from '@{{projectName}}/backend/convex/_generated/dataModel
|
|
5
|
+
import type { Id } from '@{{projectName}}/backend/convex/_generated/dataModel';
|
|
6
6
|
|
|
7
7
|
let newTodoText = $state('');
|
|
8
8
|
let isAdding = $state(false);
|
|
@@ -164,9 +164,6 @@
|
|
|
164
164
|
{{#if (eq api "orpc")}}
|
|
165
165
|
import { orpc } from '$lib/orpc';
|
|
166
166
|
{{/if}}
|
|
167
|
-
{{#if (eq api "trpc")}}
|
|
168
|
-
import { trpc } from '$lib/trpc';
|
|
169
|
-
{{/if}}
|
|
170
167
|
import { createQuery, createMutation } from '@tanstack/svelte-query';
|
|
171
168
|
|
|
172
169
|
let newTodoText = $state('');
|
|
@@ -208,43 +205,6 @@
|
|
|
208
205
|
})
|
|
209
206
|
);
|
|
210
207
|
{{/if}}
|
|
211
|
-
{{#if (eq api "trpc")}}
|
|
212
|
-
const todosQuery = createQuery(trpc.todo.getAll.queryOptions());
|
|
213
|
-
|
|
214
|
-
const addMutation = createMutation(
|
|
215
|
-
trpc.todo.create.mutationOptions({
|
|
216
|
-
onSuccess: () => {
|
|
217
|
-
$todosQuery.refetch();
|
|
218
|
-
newTodoText = '';
|
|
219
|
-
},
|
|
220
|
-
onError: (error) => {
|
|
221
|
-
console.error('Failed to create todo:', error?.message ?? error);
|
|
222
|
-
},
|
|
223
|
-
})
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
const toggleMutation = createMutation(
|
|
227
|
-
trpc.todo.toggle.mutationOptions({
|
|
228
|
-
onSuccess: () => {
|
|
229
|
-
$todosQuery.refetch();
|
|
230
|
-
},
|
|
231
|
-
onError: (error) => {
|
|
232
|
-
console.error('Failed to toggle todo:', error?.message ?? error);
|
|
233
|
-
},
|
|
234
|
-
})
|
|
235
|
-
);
|
|
236
|
-
|
|
237
|
-
const deleteMutation = createMutation(
|
|
238
|
-
trpc.todo.delete.mutationOptions({
|
|
239
|
-
onSuccess: () => {
|
|
240
|
-
$todosQuery.refetch();
|
|
241
|
-
},
|
|
242
|
-
onError: (error) => {
|
|
243
|
-
console.error('Failed to delete todo:', error?.message ?? error);
|
|
244
|
-
},
|
|
245
|
-
})
|
|
246
|
-
);
|
|
247
|
-
{{/if}}
|
|
248
208
|
|
|
249
209
|
function handleAddTodo(event: SubmitEvent) {
|
|
250
210
|
event.preventDefault();
|
|
@@ -271,7 +231,7 @@
|
|
|
271
231
|
</script>
|
|
272
232
|
|
|
273
233
|
<div class="p-4">
|
|
274
|
-
<h1 class="text-xl mb-4">Todos{{#if (eq api "
|
|
234
|
+
<h1 class="text-xl mb-4">Todos{{#if (eq api "orpc")}} (oRPC){{/if}}</h1>
|
|
275
235
|
|
|
276
236
|
<form onsubmit={handleAddTodo} class="flex gap-2 mb-4">
|
|
277
237
|
<input
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
{{#if (eq backend "convex")}}
|
|
4
|
-
|
|
4
|
+
import { ConvexProvider, ConvexReactClient } from "convex/react";
|
|
5
5
|
{{else}}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
{{#unless (eq api "none")}}
|
|
7
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
8
|
+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
9
|
+
{{#if (eq api "orpc")}}
|
|
10
|
+
import { queryClient } from "@/utils/orpc";
|
|
11
|
+
{{/if}}
|
|
12
|
+
{{#if (eq api "trpc")}}
|
|
13
|
+
import { queryClient } from "@/utils/trpc";
|
|
14
|
+
{{/if}}
|
|
15
|
+
{{/unless}}
|
|
16
16
|
{{/if}}
|
|
17
|
-
|
|
18
17
|
import { ThemeProvider } from "./theme-provider";
|
|
19
18
|
import { Toaster } from "./ui/sonner";
|
|
20
19
|
|
|
21
20
|
{{#if (eq backend "convex")}}
|
|
22
|
-
|
|
21
|
+
const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!);
|
|
23
22
|
{{/if}}
|
|
24
23
|
|
|
25
|
-
export default function Providers({
|
|
24
|
+
export default function Providers({
|
|
25
|
+
children
|
|
26
|
+
}: {
|
|
27
|
+
children: React.ReactNode
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
26
30
|
<ThemeProvider
|
|
27
31
|
attribute="class"
|
|
28
32
|
defaultTheme="system"
|
|
@@ -30,23 +34,21 @@ export default function Providers({ children }: { children: React.ReactNode }) {
|
|
|
30
34
|
disableTransitionOnChange
|
|
31
35
|
>
|
|
32
36
|
{{#if (eq backend "convex")}}
|
|
33
|
-
|
|
37
|
+
<ConvexProvider client={convex}>{children}</ConvexProvider>
|
|
38
|
+
{{else}}
|
|
39
|
+
{{#unless (eq api "none")}}
|
|
40
|
+
<QueryClientProvider client={queryClient}>
|
|
41
|
+
{{#if (eq api "orpc")}}
|
|
42
|
+
{children}
|
|
43
|
+
{{/if}}
|
|
44
|
+
{{#if (eq api "trpc")}}
|
|
45
|
+
{children}
|
|
46
|
+
{{/if}}
|
|
47
|
+
<ReactQueryDevtools />
|
|
48
|
+
</QueryClientProvider>
|
|
34
49
|
{{else}}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{{#if (eq api "orpc")}}
|
|
38
|
-
<ORPCContext.Provider value={orpc}>
|
|
39
|
-
{children}
|
|
40
|
-
</ORPCContext.Provider>
|
|
41
|
-
{{/if}}
|
|
42
|
-
{{#if (eq api "trpc")}}
|
|
43
|
-
{children}
|
|
44
|
-
{{/if}}
|
|
45
|
-
<ReactQueryDevtools />
|
|
46
|
-
</QueryClientProvider>
|
|
47
|
-
{{else}}
|
|
48
|
-
{children}
|
|
49
|
-
{{/unless}}
|
|
50
|
+
{children}
|
|
51
|
+
{{/unless}}
|
|
50
52
|
{{/if}}
|
|
51
53
|
<Toaster richColors />
|
|
52
54
|
</ThemeProvider>
|
|
@@ -13,18 +13,18 @@ import { ThemeProvider } from "./components/theme-provider";
|
|
|
13
13
|
import { Toaster } from "./components/ui/sonner";
|
|
14
14
|
|
|
15
15
|
{{#if (eq backend "convex")}}
|
|
16
|
-
|
|
16
|
+
import { ConvexProvider, ConvexReactClient } from "convex/react";
|
|
17
17
|
{{else}}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
{{#unless (eq api "none")}}
|
|
19
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
20
|
+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
21
|
+
{{#if (eq api "orpc")}}
|
|
22
|
+
import { queryClient } from "./utils/orpc";
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{#if (eq api "trpc")}}
|
|
25
|
+
import { queryClient } from "./utils/trpc";
|
|
26
|
+
{{/if}}
|
|
27
|
+
{{/unless}}
|
|
28
28
|
{{/if}}
|
|
29
29
|
|
|
30
30
|
export const links: Route.LinksFunction = () => [
|
|
@@ -62,43 +62,26 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
{{#if (eq backend "convex")}}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
65
|
+
export default function App() {
|
|
66
|
+
const convex = new ConvexReactClient(
|
|
67
|
+
import.meta.env.VITE_CONVEX_URL as string,
|
|
68
|
+
);
|
|
69
|
+
return (
|
|
70
|
+
<ConvexProvider client={convex}>
|
|
71
|
+
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
72
|
+
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
73
|
+
<Header />
|
|
74
|
+
<Outlet />
|
|
75
|
+
</div>
|
|
76
|
+
<Toaster richColors />
|
|
77
|
+
</ThemeProvider>
|
|
78
|
+
</ConvexProvider>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
81
|
{{else if (eq api "orpc")}}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<ORPCContext.Provider value={orpc}>
|
|
86
|
-
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
87
|
-
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
88
|
-
<Header />
|
|
89
|
-
<Outlet />
|
|
90
|
-
</div>
|
|
91
|
-
<Toaster richColors />
|
|
92
|
-
</ThemeProvider>
|
|
93
|
-
</ORPCContext.Provider>
|
|
94
|
-
<ReactQueryDevtools position="bottom" buttonPosition="bottom-right" />
|
|
95
|
-
</QueryClientProvider>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
{{else if (eq api "trpc")}}
|
|
99
|
-
export default function App() {
|
|
100
|
-
return (
|
|
101
|
-
<QueryClientProvider client={queryClient}>
|
|
82
|
+
export default function App() {
|
|
83
|
+
return (
|
|
84
|
+
<QueryClientProvider client={queryClient}>
|
|
102
85
|
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
103
86
|
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
104
87
|
<Header />
|
|
@@ -106,13 +89,14 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
106
89
|
</div>
|
|
107
90
|
<Toaster richColors />
|
|
108
91
|
</ThemeProvider>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{{else}}
|
|
114
|
-
|
|
115
|
-
|
|
92
|
+
<ReactQueryDevtools position="bottom" buttonPosition="bottom-right" />
|
|
93
|
+
</QueryClientProvider>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
{{else if (eq api "trpc")}}
|
|
97
|
+
export default function App() {
|
|
98
|
+
return (
|
|
99
|
+
<QueryClientProvider client={queryClient}>
|
|
116
100
|
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
117
101
|
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
118
102
|
<Header />
|
|
@@ -120,8 +104,22 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
120
104
|
</div>
|
|
121
105
|
<Toaster richColors />
|
|
122
106
|
</ThemeProvider>
|
|
123
|
-
|
|
124
|
-
|
|
107
|
+
<ReactQueryDevtools position="bottom" buttonPosition="bottom-right" />
|
|
108
|
+
</QueryClientProvider>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
{{else}}
|
|
112
|
+
export default function App() {
|
|
113
|
+
return (
|
|
114
|
+
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
115
|
+
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
116
|
+
<Header />
|
|
117
|
+
<Outlet />
|
|
118
|
+
</div>
|
|
119
|
+
<Toaster richColors />
|
|
120
|
+
</ThemeProvider>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
125
123
|
{{/if}}
|
|
126
124
|
|
|
127
125
|
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
@@ -8,7 +8,7 @@ import type { QueryClient } from "@tanstack/react-query";
|
|
|
8
8
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
9
9
|
import { useState } from "react";
|
|
10
10
|
import type { RouterClient } from "@orpc/server";
|
|
11
|
-
import {
|
|
11
|
+
import { createTanstackQueryUtils } from "@orpc/tanstack-query";
|
|
12
12
|
import type { appRouter } from "../../../server/src/routers";
|
|
13
13
|
import { createORPCClient } from "@orpc/client";
|
|
14
14
|
{{/if}}
|
|
@@ -68,14 +68,13 @@ function RootComponent() {
|
|
|
68
68
|
|
|
69
69
|
{{#if (eq api "orpc")}}
|
|
70
70
|
const [client] = useState<RouterClient<typeof appRouter>>(() => createORPCClient(link));
|
|
71
|
-
const [orpcUtils] = useState(() =>
|
|
71
|
+
const [orpcUtils] = useState(() => createTanstackQueryUtils(client));
|
|
72
72
|
{{/if}}
|
|
73
73
|
|
|
74
74
|
return (
|
|
75
75
|
<>
|
|
76
76
|
<HeadContent />
|
|
77
77
|
{{#if (eq api "orpc")}}
|
|
78
|
-
<ORPCContext.Provider value={orpcUtils}>
|
|
79
78
|
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
80
79
|
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
81
80
|
<Header />
|
|
@@ -83,7 +82,6 @@ function RootComponent() {
|
|
|
83
82
|
</div>
|
|
84
83
|
<Toaster richColors />
|
|
85
84
|
</ThemeProvider>
|
|
86
|
-
</ORPCContext.Provider>
|
|
87
85
|
{{else}}
|
|
88
86
|
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
|
89
87
|
<div className="grid grid-rows-[auto_1fr] h-svh">
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
"@radix-ui/react-label": "^2.1.2",
|
|
15
15
|
"@radix-ui/react-slot": "^1.1.2",
|
|
16
16
|
"@tanstack/react-form": "^1.0.5",
|
|
17
|
-
"@tailwindcss/vite": "^4.
|
|
18
|
-
"@tanstack/react-query": "^5.
|
|
19
|
-
"@tanstack/react-router": "^1.
|
|
20
|
-
"@tanstack/react-router-with-query": "^1.
|
|
21
|
-
"@tanstack/react-start": "^1.
|
|
22
|
-
"@tanstack/router-plugin": "^1.
|
|
17
|
+
"@tailwindcss/vite": "^4.1.8",
|
|
18
|
+
"@tanstack/react-query": "^5.80.5",
|
|
19
|
+
"@tanstack/react-router": "^1.120.15",
|
|
20
|
+
"@tanstack/react-router-with-query": "^1.120.15",
|
|
21
|
+
"@tanstack/react-start": "^1.120.15",
|
|
22
|
+
"@tanstack/router-plugin": "^1.120.15",
|
|
23
23
|
"class-variance-authority": "^0.7.1",
|
|
24
24
|
"clsx": "^2.1.1",
|
|
25
25
|
"lucide-react": "^0.473.0",
|
|
26
26
|
"next-themes": "^0.4.6",
|
|
27
|
-
"react": "^19.
|
|
28
|
-
"react-dom": "^19.
|
|
27
|
+
"react": "^19.1.0",
|
|
28
|
+
"react-dom": "^19.1.0",
|
|
29
29
|
"sonner": "^2.0.3",
|
|
30
30
|
"tailwindcss": "^4.1.3",
|
|
31
31
|
"tailwind-merge": "^2.6.0",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"zod": "^3.25.16"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@tanstack/react-router-devtools": "^1.
|
|
38
|
+
"@tanstack/react-router-devtools": "^1.120.15",
|
|
39
39
|
"@testing-library/dom": "^10.4.0",
|
|
40
40
|
"@testing-library/react": "^16.2.0",
|
|
41
|
-
"@types/react": "^19.
|
|
42
|
-
"@types/react-dom": "^19.
|
|
41
|
+
"@types/react": "^19.1.6",
|
|
42
|
+
"@types/react-dom": "^19.1.6",
|
|
43
43
|
"@vitejs/plugin-react": "^4.3.4",
|
|
44
44
|
"jsdom": "^26.0.0",
|
|
45
45
|
"typescript": "^5.7.2",
|
|
46
|
-
"vite": "^6.
|
|
46
|
+
"vite": "^6.3.5",
|
|
47
47
|
"web-vitals": "^4.2.4"
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -20,8 +20,8 @@ import { toast } from "sonner";
|
|
|
20
20
|
import type { AppRouter } from "../../server/src/routers";
|
|
21
21
|
import { TRPCProvider } from "./utils/trpc";
|
|
22
22
|
{{else if (eq api "orpc")}}
|
|
23
|
-
import {
|
|
24
|
-
import { orpc,
|
|
23
|
+
import { QueryClientProvider } from "@tanstack/react-query";
|
|
24
|
+
import { orpc, queryClient } from "./utils/orpc";
|
|
25
25
|
{{/if}}
|
|
26
26
|
{{/if}}
|
|
27
27
|
|
|
@@ -99,7 +99,6 @@ const trpc = createTRPCOptionsProxy({
|
|
|
99
99
|
queryClient: queryClient,
|
|
100
100
|
});
|
|
101
101
|
{{else if (eq api "orpc")}}
|
|
102
|
-
const queryClient = orpcQueryClient;
|
|
103
102
|
{{/if}}
|
|
104
103
|
|
|
105
104
|
export const createRouter = () => {
|
|
@@ -127,9 +126,7 @@ export const createRouter = () => {
|
|
|
127
126
|
{{else if (eq api "orpc")}}
|
|
128
127
|
Wrap: ({ children }) => (
|
|
129
128
|
<QueryClientProvider client={queryClient}>
|
|
130
|
-
|
|
131
|
-
{children}
|
|
132
|
-
</ORPCContext.Provider>
|
|
129
|
+
{children}
|
|
133
130
|
</QueryClientProvider>
|
|
134
131
|
),
|
|
135
132
|
{{else}}
|
|
@@ -9,7 +9,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
9
9
|
import { useTRPC } from "@/utils/trpc";
|
|
10
10
|
{{/if}}
|
|
11
11
|
{{#if (eq api "orpc")}}
|
|
12
|
-
import {
|
|
12
|
+
import { orpc } from "@/utils/orpc";
|
|
13
13
|
{{/if}}
|
|
14
14
|
{{/if}}
|
|
15
15
|
|
|
@@ -40,7 +40,6 @@ function HomeComponent() {
|
|
|
40
40
|
const trpc = useTRPC();
|
|
41
41
|
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
42
42
|
{{else if (eq api "orpc")}}
|
|
43
|
-
const orpc = useORPC();
|
|
44
43
|
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
45
44
|
{{/if}}
|
|
46
45
|
|
|
@@ -9,17 +9,11 @@
|
|
|
9
9
|
"test": "vitest run"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@orpc/client": "^1.1.1",
|
|
13
|
-
"@orpc/server": "^1.1.1",
|
|
14
|
-
"@orpc/solid-query": "^1.1.1",
|
|
15
12
|
"@tailwindcss/vite": "^4.0.6",
|
|
16
13
|
"@tanstack/router-plugin": "^1.109.2",
|
|
17
14
|
"@tanstack/solid-form": "^1.9.0",
|
|
18
|
-
"@tanstack/solid-query": "^5.75.0",
|
|
19
|
-
"@tanstack/solid-query-devtools": "^5.75.0",
|
|
20
15
|
"@tanstack/solid-router": "^1.110.0",
|
|
21
16
|
"@tanstack/solid-router-devtools": "^1.109.2",
|
|
22
|
-
"better-auth": "^1.2.7",
|
|
23
17
|
"lucide-solid": "^0.507.0",
|
|
24
18
|
"solid-js": "^1.9.4",
|
|
25
19
|
"tailwindcss": "^4.0.6",
|