create-better-t-stack 3.1.4 → 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-DfqHfdEO.js → src-AeW2CVNz.js} +14 -4
- 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/templates/frontend/native/nativewind/metro.config.js.hbs +5 -24
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1388,7 +1388,7 @@ const getLatestCLIVersion = () => {
|
|
|
1388
1388
|
*/
|
|
1389
1389
|
function isTelemetryEnabled() {
|
|
1390
1390
|
const BTS_TELEMETRY_DISABLED = process.env.BTS_TELEMETRY_DISABLED;
|
|
1391
|
-
const BTS_TELEMETRY = "
|
|
1391
|
+
const BTS_TELEMETRY = "0";
|
|
1392
1392
|
if (BTS_TELEMETRY_DISABLED !== void 0) return BTS_TELEMETRY_DISABLED !== "1";
|
|
1393
1393
|
if (BTS_TELEMETRY !== void 0) return BTS_TELEMETRY === "1";
|
|
1394
1394
|
return true;
|
|
@@ -1396,8 +1396,8 @@ function isTelemetryEnabled() {
|
|
|
1396
1396
|
|
|
1397
1397
|
//#endregion
|
|
1398
1398
|
//#region src/utils/analytics.ts
|
|
1399
|
-
const POSTHOG_API_KEY = "
|
|
1400
|
-
const POSTHOG_HOST = "
|
|
1399
|
+
const POSTHOG_API_KEY = "random";
|
|
1400
|
+
const POSTHOG_HOST = "random";
|
|
1401
1401
|
function generateSessionId() {
|
|
1402
1402
|
const rand = Math.random().toString(36).slice(2);
|
|
1403
1403
|
return `cli_${Date.now().toString(36)}${rand}`;
|
|
@@ -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
|
+
}
|
|
@@ -1,31 +1,12 @@
|
|
|
1
1
|
// Learn more https://docs.expo.io/guides/customizing-metro
|
|
2
2
|
const { getDefaultConfig } = require("expo/metro-config");
|
|
3
|
-
const { FileStore } = require("metro-cache");
|
|
4
3
|
const { withNativeWind } = require("nativewind/metro");
|
|
5
|
-
const path = require("node:path");
|
|
6
4
|
|
|
7
|
-
const config =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}),
|
|
12
|
-
);
|
|
5
|
+
const config = withNativeWind(getDefaultConfig(__dirname), {
|
|
6
|
+
input: "./global.css",
|
|
7
|
+
configPath: "./tailwind.config.js",
|
|
8
|
+
});
|
|
13
9
|
|
|
14
10
|
config.resolver.unstable_enablePackageExports = true;
|
|
15
11
|
|
|
16
|
-
module.exports = config;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Move the Metro cache to the `.cache/metro` folder.
|
|
20
|
-
* If you have any environment variables, you can configure Turborepo to invalidate it when needed.
|
|
21
|
-
*
|
|
22
|
-
* @see https://turbo.build/repo/docs/reference/configuration#env
|
|
23
|
-
* @param {import('expo/metro-config').MetroConfig} config
|
|
24
|
-
* @returns {import('expo/metro-config').MetroConfig}
|
|
25
|
-
*/
|
|
26
|
-
function withTurborepoManagedCache(config) {
|
|
27
|
-
config.cacheStores = [
|
|
28
|
-
new FileStore({ root: path.join(__dirname, ".cache/metro") }),
|
|
29
|
-
];
|
|
30
|
-
return config;
|
|
31
|
-
}
|
|
12
|
+
module.exports = config;
|