create-better-t-stack 2.9.2 → 2.9.3
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 +2 -2
- package/package.json +1 -1
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +2 -5
- package/templates/examples/todo/web/react/next/src/app/todos/page.tsx.hbs +91 -8
- package/templates/examples/todo/web/react/react-router/src/routes/todos.tsx.hbs +0 -1
- package/templates/frontend/native/nativewind/app/(drawer)/index.tsx.hbs +28 -20
- package/templates/frontend/native/nativewind/app/_layout.tsx.hbs +17 -0
- package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +31 -15
- package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +24 -0
- package/templates/frontend/nuxt/app/pages/{index.vue → index.vue.hbs} +6 -1
- package/templates/frontend/react/next/src/app/page.tsx.hbs +19 -15
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +34 -33
- package/templates/frontend/react/react-router/src/root.tsx.hbs +60 -44
- package/templates/frontend/react/react-router/src/routes/_index.tsx.hbs +21 -17
- package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +26 -29
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +14 -44
- package/templates/frontend/react/tanstack-router/src/routes/index.tsx.hbs +17 -14
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +18 -17
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +12 -2
- package/templates/frontend/react/tanstack-start/src/routes/index.tsx.hbs +21 -20
- package/templates/frontend/solid/src/main.tsx.hbs +6 -0
- package/templates/frontend/solid/src/routes/__root.tsx.hbs +14 -1
- package/templates/frontend/solid/src/routes/index.tsx.hbs +8 -1
- package/templates/frontend/svelte/src/routes/+layout.svelte.hbs +16 -5
- package/templates/frontend/svelte/src/routes/+page.svelte.hbs +4 -14
- /package/templates/frontend/nuxt/app/layouts/{default.vue → default.vue.hbs} +0 -0
- /package/templates/frontend/nuxt/app/plugins/{vue-query.ts → vue-query.ts.hbs} +0 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Toaster } from "@/components/ui/sonner";
|
|
2
|
+
{{#unless (eq backend "convex")}} {{#unless (eq api "none")}}
|
|
2
3
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
4
|
+
{{/unless}} {{/unless}}
|
|
3
5
|
import {
|
|
4
6
|
HeadContent,
|
|
5
7
|
Outlet,
|
|
@@ -10,7 +12,9 @@ import {
|
|
|
10
12
|
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
|
11
13
|
import Header from "../components/header";
|
|
12
14
|
import appCss from "../index.css?url";
|
|
15
|
+
{{#unless (and (eq api "none") (not (eq backend "convex"))}}
|
|
13
16
|
import type { QueryClient } from "@tanstack/react-query";
|
|
17
|
+
{{/unless}}
|
|
14
18
|
import Loader from "@/components/loader";
|
|
15
19
|
|
|
16
20
|
{{#if (eq backend "convex")}}
|
|
@@ -25,12 +29,14 @@ export interface RouterAppContext {
|
|
|
25
29
|
trpc: TRPCOptionsProxy<AppRouter>;
|
|
26
30
|
queryClient: QueryClient;
|
|
27
31
|
}
|
|
28
|
-
{{
|
|
29
|
-
{{#if (eq api "orpc")}}
|
|
32
|
+
{{else if (eq api "orpc")}}
|
|
30
33
|
import type { orpc } from "@/utils/orpc";
|
|
31
34
|
export interface RouterAppContext {
|
|
32
35
|
orpc: typeof orpc;
|
|
33
36
|
queryClient: QueryClient;
|
|
37
|
+
}
|
|
38
|
+
{{else}}
|
|
39
|
+
export interface RouterAppContext {
|
|
34
40
|
}
|
|
35
41
|
{{/if}}
|
|
36
42
|
{{/if}}
|
|
@@ -75,7 +81,11 @@ function RootDocument() {
|
|
|
75
81
|
</div>
|
|
76
82
|
<Toaster richColors />
|
|
77
83
|
<TanStackRouterDevtools position="bottom-left" />
|
|
84
|
+
{{#unless (eq backend "convex")}}
|
|
85
|
+
{{#unless (eq api "none")}}
|
|
78
86
|
<ReactQueryDevtools position="bottom" buttonPosition="bottom-right" />
|
|
87
|
+
{{/unless}}
|
|
88
|
+
{{/unless}}
|
|
79
89
|
<Scripts />
|
|
80
90
|
</body>
|
|
81
91
|
</html>
|
|
@@ -3,14 +3,14 @@ import { createFileRoute } from "@tanstack/react-router";
|
|
|
3
3
|
import { convexQuery } from "@convex-dev/react-query";
|
|
4
4
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
5
5
|
import { api } from "@{{projectName}}/backend/convex/_generated/api.js";
|
|
6
|
-
{{else}}
|
|
6
|
+
{{else if (or (eq api "trpc") (eq api "orpc"))}}
|
|
7
|
+
import { useQuery } from "@tanstack/react-query";
|
|
7
8
|
{{#if (eq api "trpc")}}
|
|
8
9
|
import { useTRPC } from "@/utils/trpc";
|
|
9
10
|
{{/if}}
|
|
10
11
|
{{#if (eq api "orpc")}}
|
|
11
12
|
import { useORPC } from "@/utils/orpc";
|
|
12
13
|
{{/if}}
|
|
13
|
-
import { useQuery } from "@tanstack/react-query";
|
|
14
14
|
{{/if}}
|
|
15
15
|
|
|
16
16
|
export const Route = createFileRoute("/")({
|
|
@@ -36,15 +36,12 @@ const TITLE_TEXT = `
|
|
|
36
36
|
function HomeComponent() {
|
|
37
37
|
{{#if (eq backend "convex")}}
|
|
38
38
|
const healthCheck = useSuspenseQuery(convexQuery(api.healthCheck.get, {}));
|
|
39
|
-
{{else}}
|
|
40
|
-
{{#if (eq api "trpc")}}
|
|
39
|
+
{{else if (eq api "trpc")}}
|
|
41
40
|
const trpc = useTRPC();
|
|
42
41
|
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
43
|
-
|
|
44
|
-
{{#if (eq api "orpc")}}
|
|
42
|
+
{{else if (eq api "orpc")}}
|
|
45
43
|
const orpc = useORPC();
|
|
46
44
|
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
47
|
-
{{/if}}
|
|
48
45
|
{{/if}}
|
|
49
46
|
|
|
50
47
|
return (
|
|
@@ -53,8 +50,8 @@ function HomeComponent() {
|
|
|
53
50
|
<div className="grid gap-6">
|
|
54
51
|
<section className="rounded-lg border p-4">
|
|
55
52
|
<h2 className="mb-2 font-medium">API Status</h2>
|
|
53
|
+
{{#if (eq backend "convex")}}
|
|
56
54
|
<div className="flex items-center gap-2">
|
|
57
|
-
{{#if (eq backend "convex")}}
|
|
58
55
|
<div
|
|
59
56
|
className={`h-2 w-2 rounded-full ${healthCheck.data === "OK" ? "bg-green-500" : healthCheck.isLoading ? "bg-orange-400" : "bg-red-500"}`}
|
|
60
57
|
/>
|
|
@@ -65,19 +62,23 @@ function HomeComponent() {
|
|
|
65
62
|
? "Connected"
|
|
66
63
|
: "Error"}
|
|
67
64
|
</span>
|
|
68
|
-
{{else}}
|
|
69
|
-
<div
|
|
70
|
-
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
|
71
|
-
/>
|
|
72
|
-
<span className="text-muted-foreground text-sm">
|
|
73
|
-
{healthCheck.isLoading
|
|
74
|
-
? "Checking..."
|
|
75
|
-
: healthCheck.data
|
|
76
|
-
? "Connected"
|
|
77
|
-
: "Disconnected"}
|
|
78
|
-
</span>
|
|
79
|
-
{{/if}}
|
|
80
65
|
</div>
|
|
66
|
+
{{else}}
|
|
67
|
+
{{#unless (eq api "none")}}
|
|
68
|
+
<div className="flex items-center gap-2">
|
|
69
|
+
<div
|
|
70
|
+
className={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
|
71
|
+
/>
|
|
72
|
+
<span className="text-muted-foreground text-sm">
|
|
73
|
+
{healthCheck.isLoading
|
|
74
|
+
? "Checking..."
|
|
75
|
+
: healthCheck.data
|
|
76
|
+
? "Connected"
|
|
77
|
+
: "Disconnected"}
|
|
78
|
+
</span>
|
|
79
|
+
</div>
|
|
80
|
+
{{/unless}}
|
|
81
|
+
{{/if}}
|
|
81
82
|
</section>
|
|
82
83
|
</div>
|
|
83
84
|
</div>
|
|
@@ -2,8 +2,10 @@ import { RouterProvider, createRouter } from "@tanstack/solid-router";
|
|
|
2
2
|
import { render } from "solid-js/web";
|
|
3
3
|
import { routeTree } from "./routeTree.gen";
|
|
4
4
|
import "./styles.css";
|
|
5
|
+
{{#if (eq api "orpc")}}
|
|
5
6
|
import { QueryClientProvider } from "@tanstack/solid-query";
|
|
6
7
|
import { queryClient } from "./utils/orpc";
|
|
8
|
+
{{/if}}
|
|
7
9
|
|
|
8
10
|
const router = createRouter({
|
|
9
11
|
routeTree,
|
|
@@ -20,9 +22,13 @@ declare module "@tanstack/solid-router" {
|
|
|
20
22
|
|
|
21
23
|
function App() {
|
|
22
24
|
return (
|
|
25
|
+
{{#if (eq api "orpc")}}
|
|
23
26
|
<QueryClientProvider client={queryClient}>
|
|
27
|
+
{{/if}}
|
|
24
28
|
<RouterProvider router={router} />
|
|
29
|
+
{{#if (eq api "orpc")}}
|
|
25
30
|
</QueryClientProvider>
|
|
31
|
+
{{/if}}
|
|
26
32
|
);
|
|
27
33
|
}
|
|
28
34
|
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import Header from "@/components/header";
|
|
2
2
|
import { Outlet, createRootRouteWithContext } from "@tanstack/solid-router";
|
|
3
3
|
import { TanStackRouterDevtools } from "@tanstack/solid-router-devtools";
|
|
4
|
+
{{#if (eq api "orpc")}}
|
|
4
5
|
import { SolidQueryDevtools } from "@tanstack/solid-query-devtools";
|
|
6
|
+
import type { QueryClient } from "@tanstack/solid-query";
|
|
7
|
+
import type { orpc } from "../utils/orpc";
|
|
5
8
|
|
|
6
|
-
export
|
|
9
|
+
export interface RouterContext {
|
|
10
|
+
orpc: typeof orpc;
|
|
11
|
+
queryClient: QueryClient;
|
|
12
|
+
}
|
|
13
|
+
{{else}}
|
|
14
|
+
export interface RouterContext {}
|
|
15
|
+
{{/if}}
|
|
16
|
+
|
|
17
|
+
export const Route = createRootRouteWithContext<RouterContext>()({
|
|
7
18
|
component: RootComponent,
|
|
8
19
|
});
|
|
9
20
|
|
|
@@ -14,7 +25,9 @@ function RootComponent() {
|
|
|
14
25
|
<Header />
|
|
15
26
|
<Outlet />
|
|
16
27
|
</div>
|
|
28
|
+
{{#if (eq api "orpc")}}
|
|
17
29
|
<SolidQueryDevtools />
|
|
30
|
+
{{/if}}
|
|
18
31
|
<TanStackRouterDevtools />
|
|
19
32
|
</>
|
|
20
33
|
);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { createFileRoute } from "@tanstack/solid-router";
|
|
2
|
+
{{#if (eq api "orpc")}}
|
|
2
3
|
import { useQuery } from "@tanstack/solid-query";
|
|
3
4
|
import { orpc } from "../utils/orpc";
|
|
4
5
|
import { Match, Switch } from "solid-js";
|
|
6
|
+
{{else}}
|
|
7
|
+
{{/if}}
|
|
5
8
|
|
|
6
9
|
export const Route = createFileRoute("/")({
|
|
7
10
|
component: App,
|
|
@@ -24,12 +27,15 @@ const TITLE_TEXT = `
|
|
|
24
27
|
`;
|
|
25
28
|
|
|
26
29
|
function App() {
|
|
30
|
+
{{#if (eq api "orpc")}}
|
|
27
31
|
const healthCheck = useQuery(() => orpc.healthCheck.queryOptions());
|
|
32
|
+
{{/if}}
|
|
28
33
|
|
|
29
34
|
return (
|
|
30
35
|
<div class="container mx-auto max-w-3xl px-4 py-2">
|
|
31
36
|
<pre class="overflow-x-auto font-mono text-sm">{TITLE_TEXT}</pre>
|
|
32
37
|
<div class="grid gap-6">
|
|
38
|
+
{{#if (eq api "orpc")}}
|
|
33
39
|
<section class="rounded-lg border p-4">
|
|
34
40
|
<h2 class="mb-2 font-medium">API Status</h2>
|
|
35
41
|
<Switch>
|
|
@@ -53,12 +59,13 @@ function App() {
|
|
|
53
59
|
<span class="text-sm text-muted-foreground">
|
|
54
60
|
{healthCheck.data
|
|
55
61
|
? "Connected"
|
|
56
|
-
: "Disconnected
|
|
62
|
+
: "Disconnected"}
|
|
57
63
|
</span>
|
|
58
64
|
</div>
|
|
59
65
|
</Match>
|
|
60
66
|
</Switch>
|
|
61
67
|
</section>
|
|
68
|
+
{{/if}}
|
|
62
69
|
</div>
|
|
63
70
|
</div>
|
|
64
71
|
);
|
|
@@ -16,16 +16,12 @@
|
|
|
16
16
|
</main>
|
|
17
17
|
</div>
|
|
18
18
|
{{else}}
|
|
19
|
+
{{#if (eq api "orpc")}}
|
|
19
20
|
<script lang="ts">
|
|
20
21
|
import { QueryClientProvider } from '@tanstack/svelte-query';
|
|
21
22
|
import { SvelteQueryDevtools } from '@tanstack/svelte-query-devtools'
|
|
22
23
|
import '../app.css';
|
|
23
|
-
{{#if (eq api "orpc")}}
|
|
24
24
|
import { queryClient } from '$lib/orpc';
|
|
25
|
-
{{/if}}
|
|
26
|
-
{{#if (eq api "trpc")}}
|
|
27
|
-
import { queryClient } from '$lib/trpc';
|
|
28
|
-
{{/if}}
|
|
29
25
|
import Header from '../components/Header.svelte';
|
|
30
26
|
|
|
31
27
|
let { children } = $props();
|
|
@@ -40,4 +36,19 @@
|
|
|
40
36
|
</div>
|
|
41
37
|
<SvelteQueryDevtools />
|
|
42
38
|
</QueryClientProvider>
|
|
39
|
+
{{else}}
|
|
40
|
+
<script lang="ts">
|
|
41
|
+
import '../app.css';
|
|
42
|
+
import Header from '../components/Header.svelte';
|
|
43
|
+
|
|
44
|
+
let { children } = $props();
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<div class="grid h-svh grid-rows-[auto_1fr]">
|
|
48
|
+
<Header />
|
|
49
|
+
<main class="overflow-y-auto">
|
|
50
|
+
{@render children()}
|
|
51
|
+
</main>
|
|
52
|
+
</div>
|
|
53
|
+
{{/if}}
|
|
43
54
|
{{/if}}
|
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
import { useQuery } from 'convex-svelte';
|
|
4
4
|
import { api } from "@{{projectName}}/backend/convex/_generated/api.js";
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
const healthCheck = useQuery(api.healthCheck.get, {});
|
|
8
7
|
|
|
9
|
-
|
|
10
8
|
const TITLE_TEXT = `
|
|
11
9
|
██████╗ ███████╗████████╗████████╗███████╗██████╗
|
|
12
10
|
██╔══██╗██╔════╝╚══██╔══╝╚══██╔══╝██╔════╝██╔══██╗
|
|
@@ -28,7 +26,7 @@ const TITLE_TEXT = `
|
|
|
28
26
|
<pre class="overflow-x-auto font-mono text-sm">{TITLE_TEXT}</pre>
|
|
29
27
|
<div class="grid gap-6">
|
|
30
28
|
<section class="rounded-lg border p-4">
|
|
31
|
-
<h2 class="mb-2 font-medium">API Status
|
|
29
|
+
<h2 class="mb-2 font-medium">API Status</h2>
|
|
32
30
|
<div class="flex items-center gap-2">
|
|
33
31
|
<div
|
|
34
32
|
class={`h-2 w-2 rounded-full ${healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
|
@@ -48,19 +46,9 @@ const TITLE_TEXT = `
|
|
|
48
46
|
<script lang="ts">
|
|
49
47
|
{{#if (eq api "orpc")}}
|
|
50
48
|
import { orpc } from "$lib/orpc";
|
|
51
|
-
{{/if}}
|
|
52
|
-
{{#if (eq api "trpc")}}
|
|
53
|
-
import { trpc } from "$lib/trpc";
|
|
54
|
-
{{/if}}
|
|
55
49
|
import { createQuery } from "@tanstack/svelte-query";
|
|
56
|
-
|
|
57
|
-
{{#if (eq api "orpc")}}
|
|
58
50
|
const healthCheck = createQuery(orpc.healthCheck.queryOptions());
|
|
59
51
|
{{/if}}
|
|
60
|
-
{{#if (eq api "trpc")}}
|
|
61
|
-
const healthCheck = createQuery(trpc.healthCheck.queryOptions());
|
|
62
|
-
{{/if}}
|
|
63
|
-
|
|
64
52
|
|
|
65
53
|
const TITLE_TEXT = `
|
|
66
54
|
██████╗ ███████╗████████╗████████╗███████╗██████╗
|
|
@@ -82,8 +70,9 @@ const TITLE_TEXT = `
|
|
|
82
70
|
<div class="container mx-auto max-w-3xl px-4 py-2">
|
|
83
71
|
<pre class="overflow-x-auto font-mono text-sm">{TITLE_TEXT}</pre>
|
|
84
72
|
<div class="grid gap-6">
|
|
73
|
+
{{#if (eq api "orpc")}}
|
|
85
74
|
<section class="rounded-lg border p-4">
|
|
86
|
-
<h2 class="mb-2 font-medium">API Status
|
|
75
|
+
<h2 class="mb-2 font-medium">API Status</h2>
|
|
87
76
|
<div class="flex items-center gap-2">
|
|
88
77
|
<div
|
|
89
78
|
class={`h-2 w-2 rounded-full ${$healthCheck.data ? "bg-green-500" : "bg-red-500"}`}
|
|
@@ -97,6 +86,7 @@ const TITLE_TEXT = `
|
|
|
97
86
|
</span>
|
|
98
87
|
</div>
|
|
99
88
|
</section>
|
|
89
|
+
{{/if}}
|
|
100
90
|
</div>
|
|
101
91
|
</div>
|
|
102
92
|
{{/if}}
|
|
File without changes
|
|
File without changes
|