create-better-t-stack 3.1.4-canary.78f76984 → 3.1.5-canary.b53fc7d5
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/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-Do-jrPff.js → src-AeW2CVNz.js} +11 -1
- package/package.json +1 -1
- package/templates/auth/better-auth/web/react/tanstack-start/src/functions/get-user.ts.hbs +6 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/middleware/auth.ts.hbs +12 -0
- package/templates/auth/better-auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +59 -52
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -2141,7 +2141,17 @@ async function setupRuler(config) {
|
|
|
2141
2141
|
opencode: { label: "OpenCode" },
|
|
2142
2142
|
crush: { label: "Crush" },
|
|
2143
2143
|
zed: { label: "Zed" },
|
|
2144
|
-
qwen: { label: "Qwen" }
|
|
2144
|
+
qwen: { label: "Qwen" },
|
|
2145
|
+
amazonqcli: { label: "Amazon Q CLI" },
|
|
2146
|
+
augmentcode: { label: "AugmentCode" },
|
|
2147
|
+
firebender: { label: "Firebender" },
|
|
2148
|
+
goose: { label: "Goose" },
|
|
2149
|
+
jules: { label: "Jules" },
|
|
2150
|
+
kiro: { label: "Kiro" },
|
|
2151
|
+
openhands: { label: "Open Hands" },
|
|
2152
|
+
roo: { label: "RooCode" },
|
|
2153
|
+
trae: { label: "Trae AI" },
|
|
2154
|
+
warp: { label: "Warp" }
|
|
2145
2155
|
}).map(([key, v]) => ({
|
|
2146
2156
|
value: key,
|
|
2147
2157
|
label: v.label
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5-canary.b53fc7d5",
|
|
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",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { auth } from "@{{projectName}}/auth";
|
|
2
|
+
import { createMiddleware } from "@tanstack/react-start";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const authMiddleware = createMiddleware().server(async ({ next, request }) => {
|
|
6
|
+
const session = await auth.api.getSession({
|
|
7
|
+
headers: request.headers,
|
|
8
|
+
})
|
|
9
|
+
return next({
|
|
10
|
+
context: { session }
|
|
11
|
+
})
|
|
12
|
+
})
|
|
@@ -1,69 +1,76 @@
|
|
|
1
|
+
import { getUser } from "@/functions/get-user";
|
|
2
|
+
{{#if (eq payments "polar") }}
|
|
1
3
|
import { Button } from "@/components/ui/button";
|
|
2
4
|
import { authClient } from "@/lib/auth-client";
|
|
3
|
-
{{
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#if (eq api "trpc") }}
|
|
4
7
|
import { useTRPC } from "@/utils/trpc";
|
|
5
8
|
import { useQuery } from "@tanstack/react-query";
|
|
6
9
|
{{/if}}
|
|
7
|
-
{{#if (eq api "orpc")}}
|
|
10
|
+
{{#if (eq api "orpc") }}
|
|
8
11
|
import { orpc } from "@/utils/orpc";
|
|
9
12
|
import { useQuery } from "@tanstack/react-query";
|
|
10
13
|
{{/if}}
|
|
11
14
|
import { createFileRoute, redirect } from "@tanstack/react-router";
|
|
12
15
|
|
|
13
16
|
export const Route = createFileRoute("/dashboard")({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
component: RouteComponent,
|
|
18
|
+
beforeLoad: async () => {
|
|
19
|
+
const session = await getUser();
|
|
20
|
+
return { session };
|
|
21
|
+
},
|
|
22
|
+
loader: async ({ context }) => {
|
|
23
|
+
if (!context.session) {
|
|
24
|
+
throw redirect({
|
|
25
|
+
to: "/login",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
{{#if (eq payments "polar") }}
|
|
29
|
+
const { data: customerState } = await authClient.customer.state();
|
|
30
|
+
return { session: context.session, customerState };
|
|
31
|
+
{{else}}
|
|
32
|
+
return { session: context.session };
|
|
33
|
+
{{/if}}
|
|
34
|
+
},
|
|
30
35
|
});
|
|
31
36
|
|
|
32
37
|
function RouteComponent() {
|
|
33
|
-
|
|
38
|
+
const { session{{#if (eq payments "polar") }}, customerState{{/if}} } = Route.useRouteContext();
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
{{#if (eq api "trpc") }}
|
|
41
|
+
const trpc = useTRPC();
|
|
42
|
+
const privateData = useQuery(trpc.privateData.queryOptions());
|
|
43
|
+
{{/if}}
|
|
44
|
+
{{#if (eq api "orpc") }}
|
|
45
|
+
const privateData = useQuery(orpc.privateData.queryOptions());
|
|
46
|
+
{{/if}}
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
{{#if (eq payments "polar") }}
|
|
49
|
+
const hasProSubscription = (customerState?.activeSubscriptions?.length ?? 0) > 0;
|
|
50
|
+
console.log("Active subscriptions:", customerState?.activeSubscriptions);
|
|
51
|
+
{{/if}}
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<h1>Dashboard</h1>
|
|
56
|
+
<p>Welcome {session?.user.name}</p>
|
|
57
|
+
{{#if (eq api "trpc") }}
|
|
58
|
+
<p>API: {privateData.data?.message}</p>
|
|
59
|
+
{{else if (eq api "orpc") }}
|
|
60
|
+
<p>API: {privateData.data?.message}</p>
|
|
61
|
+
{{/if}}
|
|
62
|
+
{{#if (eq payments "polar") }}
|
|
63
|
+
<p>Plan: {hasProSubscription ? "Pro" : "Free"}</p>
|
|
64
|
+
{hasProSubscription ? (
|
|
65
|
+
<Button onClick={async () => { await authClient.customer.portal(); }}>
|
|
66
|
+
Manage Subscription
|
|
67
|
+
</Button>
|
|
68
|
+
) : (
|
|
69
|
+
<Button onClick={async () => { await authClient.checkout({ slug: "pro" }); }}>
|
|
70
|
+
Upgrade to Pro
|
|
71
|
+
</Button>
|
|
72
|
+
)}
|
|
73
|
+
{{/if}}
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|