create-better-t-stack 3.1.8-canary.932e5243 → 3.1.8
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-EpWSiOd8.js → src-DeOVz-ZI.js} +13 -51
- package/package.json +1 -1
- package/templates/auth/better-auth/convex/backend/convex/auth.ts.hbs +2 -10
- package/templates/auth/better-auth/native/{base → native-base}/lib/auth-client.ts.hbs +2 -3
- package/templates/frontend/native/nativewind/app/(drawer)/index.tsx.hbs +100 -151
- package/templates/frontend/native/nativewind/app/_layout.tsx.hbs +0 -21
- package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +91 -201
- package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +0 -28
- package/templates/auth/better-auth/convex/native/base/lib/auth-client.ts.hbs +0 -19
- package/templates/auth/better-auth/convex/native/nativewind/components/sign-in.tsx.hbs +0 -86
- package/templates/auth/better-auth/convex/native/nativewind/components/sign-up.tsx.hbs +0 -97
- package/templates/auth/better-auth/convex/native/unistyles/components/sign-in.tsx.hbs +0 -127
- package/templates/auth/better-auth/convex/native/unistyles/components/sign-up.tsx.hbs +0 -145
- /package/templates/frontend/native/{base → native-base}/assets/images/android-icon-background.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/android-icon-foreground.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/android-icon-monochrome.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/favicon.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/icon.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/partial-react-logo.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/react-logo.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/react-logo@2x.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/react-logo@3x.png +0 -0
- /package/templates/frontend/native/{base → native-base}/assets/images/splash-icon.png +0 -0
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -627,9 +627,7 @@ async function getAuthChoice(auth, hasDatabase, backend, frontend) {
|
|
|
627
627
|
const supportedBetterAuthFrontends = frontend?.some((f) => [
|
|
628
628
|
"tanstack-router",
|
|
629
629
|
"tanstack-start",
|
|
630
|
-
"next"
|
|
631
|
-
"native-nativewind",
|
|
632
|
-
"native-unistyles"
|
|
630
|
+
"next"
|
|
633
631
|
].includes(f));
|
|
634
632
|
const hasClerkCompatibleFrontends = frontend?.some((f) => [
|
|
635
633
|
"react-router",
|
|
@@ -1390,7 +1388,7 @@ const getLatestCLIVersion = () => {
|
|
|
1390
1388
|
*/
|
|
1391
1389
|
function isTelemetryEnabled() {
|
|
1392
1390
|
const BTS_TELEMETRY_DISABLED = process.env.BTS_TELEMETRY_DISABLED;
|
|
1393
|
-
const BTS_TELEMETRY = "
|
|
1391
|
+
const BTS_TELEMETRY = "1";
|
|
1394
1392
|
if (BTS_TELEMETRY_DISABLED !== void 0) return BTS_TELEMETRY_DISABLED !== "1";
|
|
1395
1393
|
if (BTS_TELEMETRY !== void 0) return BTS_TELEMETRY === "1";
|
|
1396
1394
|
return true;
|
|
@@ -1398,8 +1396,8 @@ function isTelemetryEnabled() {
|
|
|
1398
1396
|
|
|
1399
1397
|
//#endregion
|
|
1400
1398
|
//#region src/utils/analytics.ts
|
|
1401
|
-
const POSTHOG_API_KEY = "
|
|
1402
|
-
const POSTHOG_HOST = "
|
|
1399
|
+
const POSTHOG_API_KEY = "phc_8ZUxEwwfKMajJLvxz1daGd931dYbQrwKNficBmsdIrs";
|
|
1400
|
+
const POSTHOG_HOST = "https://us.i.posthog.com";
|
|
1403
1401
|
function generateSessionId() {
|
|
1404
1402
|
const rand = Math.random().toString(36).slice(2);
|
|
1405
1403
|
return `cli_${Date.now().toString(36)}${rand}`;
|
|
@@ -1752,11 +1750,9 @@ function validateConvexConstraints(config, providedFlags) {
|
|
|
1752
1750
|
const supportedFrontends = [
|
|
1753
1751
|
"tanstack-router",
|
|
1754
1752
|
"tanstack-start",
|
|
1755
|
-
"next"
|
|
1756
|
-
"native-nativewind",
|
|
1757
|
-
"native-unistyles"
|
|
1753
|
+
"next"
|
|
1758
1754
|
];
|
|
1759
|
-
if (!config.frontend?.some((f) => supportedFrontends.includes(f))) exitWithError("Better-Auth with Convex backend
|
|
1755
|
+
if (!config.frontend?.some((f) => supportedFrontends.includes(f))) exitWithError("Better-Auth with Convex backend is only supported with TanStack Router, TanStack Start, or Next.js frontends. Please use '--auth clerk' or '--auth none'.");
|
|
1760
1756
|
}
|
|
1761
1757
|
}
|
|
1762
1758
|
function validateBackendNoneConstraints(config, providedFlags) {
|
|
@@ -2802,7 +2798,7 @@ async function setupFrontendTemplates(projectDir, context) {
|
|
|
2802
2798
|
if (hasNativeWind || hasUnistyles) {
|
|
2803
2799
|
const nativeAppDir = path.join(projectDir, "apps/native");
|
|
2804
2800
|
await fs.ensureDir(nativeAppDir);
|
|
2805
|
-
const nativeBaseCommonDir = path.join(PKG_ROOT, "templates/frontend/native/base");
|
|
2801
|
+
const nativeBaseCommonDir = path.join(PKG_ROOT, "templates/frontend/native/native-base");
|
|
2806
2802
|
if (await fs.pathExists(nativeBaseCommonDir)) await processAndCopyFiles("**/*", nativeBaseCommonDir, nativeAppDir, context);
|
|
2807
2803
|
let nativeFrameworkPath = "";
|
|
2808
2804
|
if (hasNativeWind) nativeFrameworkPath = "nativewind";
|
|
@@ -2938,17 +2934,6 @@ async function setupAuthTemplate(projectDir, context) {
|
|
|
2938
2934
|
if (await fs.pathExists(convexBetterAuthWebSrc)) await processAndCopyFiles("**/*", convexBetterAuthWebSrc, webAppDir, context);
|
|
2939
2935
|
}
|
|
2940
2936
|
}
|
|
2941
|
-
if (nativeAppDirExists) {
|
|
2942
|
-
const convexBetterAuthNativeBaseSrc = path.join(PKG_ROOT, "templates/auth/better-auth/convex/native/base");
|
|
2943
|
-
if (await fs.pathExists(convexBetterAuthNativeBaseSrc)) await processAndCopyFiles("**/*", convexBetterAuthNativeBaseSrc, nativeAppDir, context);
|
|
2944
|
-
let nativeFrameworkPath = "";
|
|
2945
|
-
if (hasNativeWind) nativeFrameworkPath = "nativewind";
|
|
2946
|
-
else if (hasUnistyles) nativeFrameworkPath = "unistyles";
|
|
2947
|
-
if (nativeFrameworkPath) {
|
|
2948
|
-
const convexBetterAuthNativeFrameworkSrc = path.join(PKG_ROOT, `templates/auth/better-auth/convex/native/${nativeFrameworkPath}`);
|
|
2949
|
-
if (await fs.pathExists(convexBetterAuthNativeFrameworkSrc)) await processAndCopyFiles("**/*", convexBetterAuthNativeFrameworkSrc, nativeAppDir, context);
|
|
2950
|
-
}
|
|
2951
|
-
}
|
|
2952
2937
|
return;
|
|
2953
2938
|
}
|
|
2954
2939
|
if ((serverAppDirExists || context.backend === "self") && context.backend !== "convex") {
|
|
@@ -2998,7 +2983,7 @@ async function setupAuthTemplate(projectDir, context) {
|
|
|
2998
2983
|
}
|
|
2999
2984
|
}
|
|
3000
2985
|
if (hasNative && nativeAppDirExists) {
|
|
3001
|
-
const authNativeBaseSrc = path.join(PKG_ROOT, `templates/auth/${authProvider}/native/base`);
|
|
2986
|
+
const authNativeBaseSrc = path.join(PKG_ROOT, `templates/auth/${authProvider}/native/native-base`);
|
|
3002
2987
|
if (await fs.pathExists(authNativeBaseSrc)) await processAndCopyFiles("**/*", authNativeBaseSrc, nativeAppDir, context);
|
|
3003
2988
|
let nativeFrameworkAuthPath = "";
|
|
3004
2989
|
if (hasNativeWind) nativeFrameworkAuthPath = "nativewind";
|
|
@@ -4482,20 +4467,11 @@ async function setupAuth(config) {
|
|
|
4482
4467
|
}
|
|
4483
4468
|
if (auth === "better-auth") {
|
|
4484
4469
|
const convexBackendDir = path.join(projectDir, "packages/backend");
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
customDependencies: { "better-auth": "1.3.27" },
|
|
4491
|
-
projectDir: convexBackendDir
|
|
4492
|
-
});
|
|
4493
|
-
if (hasNativeForBA) await addPackageDependency({
|
|
4494
|
-
dependencies: ["@better-auth/expo"],
|
|
4495
|
-
customDependencies: { "@better-auth/expo": "1.3.27" },
|
|
4496
|
-
projectDir: convexBackendDir
|
|
4497
|
-
});
|
|
4498
|
-
}
|
|
4470
|
+
if (await fs.pathExists(convexBackendDir)) await addPackageDependency({
|
|
4471
|
+
dependencies: ["better-auth", "@convex-dev/better-auth"],
|
|
4472
|
+
customDependencies: { "better-auth": "1.3.27" },
|
|
4473
|
+
projectDir: convexBackendDir
|
|
4474
|
+
});
|
|
4499
4475
|
if (clientDirExists) {
|
|
4500
4476
|
const hasNextJs = frontend.includes("next");
|
|
4501
4477
|
const hasTanStackStart = frontend.includes("tanstack-start");
|
|
@@ -4516,20 +4492,6 @@ async function setupAuth(config) {
|
|
|
4516
4492
|
projectDir: clientDir
|
|
4517
4493
|
});
|
|
4518
4494
|
}
|
|
4519
|
-
const hasNativeWind$1 = frontend.includes("native-nativewind");
|
|
4520
|
-
const hasUnistyles$1 = frontend.includes("native-unistyles");
|
|
4521
|
-
if (nativeDirExists && (hasNativeWind$1 || hasUnistyles$1)) await addPackageDependency({
|
|
4522
|
-
dependencies: [
|
|
4523
|
-
"better-auth",
|
|
4524
|
-
"@better-auth/expo",
|
|
4525
|
-
"@convex-dev/better-auth"
|
|
4526
|
-
],
|
|
4527
|
-
customDependencies: {
|
|
4528
|
-
"better-auth": "1.3.27",
|
|
4529
|
-
"@better-auth/expo": "1.3.27"
|
|
4530
|
-
},
|
|
4531
|
-
projectDir: nativeDir
|
|
4532
|
-
});
|
|
4533
4495
|
}
|
|
4534
4496
|
const hasNativeWind = frontend.includes("native-nativewind");
|
|
4535
4497
|
const hasUnistyles = frontend.includes("native-unistyles");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.1.8
|
|
3
|
+
"version": "3.1.8",
|
|
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,8 +1,5 @@
|
|
|
1
1
|
import { createClient, type GenericCtx } from "@convex-dev/better-auth";
|
|
2
|
-
{{#if (or (includes frontend "
|
|
3
|
-
import { convex } from "@convex-dev/better-auth/plugins";
|
|
4
|
-
import { expo } from "@better-auth/expo";
|
|
5
|
-
{{else if (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
2
|
+
{{#if (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
6
3
|
import { convex } from "@convex-dev/better-auth/plugins";
|
|
7
4
|
{{else}}
|
|
8
5
|
import { convex, crossDomain } from "@convex-dev/better-auth/plugins";
|
|
@@ -24,9 +21,7 @@ export const createAuth = (
|
|
|
24
21
|
logger: {
|
|
25
22
|
disabled: optionsOnly,
|
|
26
23
|
},
|
|
27
|
-
{{#if (or (includes frontend "
|
|
28
|
-
trustedOrigins: ["mybettertapp://"],
|
|
29
|
-
{{else if (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
24
|
+
{{#if (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
30
25
|
baseURL: siteUrl,
|
|
31
26
|
trustedOrigins: [siteUrl],
|
|
32
27
|
{{else}}
|
|
@@ -38,9 +33,6 @@ export const createAuth = (
|
|
|
38
33
|
requireEmailVerification: false,
|
|
39
34
|
},
|
|
40
35
|
plugins: [
|
|
41
|
-
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
42
|
-
expo(),
|
|
43
|
-
{{/if}}
|
|
44
36
|
{{#unless (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
45
37
|
crossDomain({ siteUrl }),
|
|
46
38
|
{{/unless}}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { expoClient } from "@better-auth/expo/client";
|
|
2
2
|
import { createAuthClient } from "better-auth/react";
|
|
3
3
|
import * as SecureStore from "expo-secure-store";
|
|
4
|
-
import Constants from "expo-constants";
|
|
5
4
|
|
|
6
5
|
export const authClient = createAuthClient({
|
|
7
6
|
baseURL: process.env.EXPO_PUBLIC_SERVER_URL,
|
|
8
7
|
plugins: [
|
|
9
8
|
expoClient({
|
|
10
|
-
|
|
11
|
-
storagePrefix:
|
|
9
|
+
scheme: "mybettertapp",
|
|
10
|
+
storagePrefix: "{{projectName}}",
|
|
12
11
|
storage: SecureStore,
|
|
13
12
|
}),
|
|
14
13
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { View, Text, ScrollView
|
|
1
|
+
import { View, Text, ScrollView } from "react-native";
|
|
2
2
|
import { Container } from "@/components/container";
|
|
3
3
|
{{#if (eq api "orpc")}}
|
|
4
4
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -16,163 +16,112 @@ import { api } from "@{{ projectName }}/backend/convex/_generated/api";
|
|
|
16
16
|
import { useUser } from "@clerk/clerk-expo";
|
|
17
17
|
import { SignOutButton } from "@/components/sign-out-button";
|
|
18
18
|
{{else}}
|
|
19
|
-
{{#if (eq auth "better-auth")}}
|
|
20
|
-
import { useConvexAuth, useQuery } from "convex/react";
|
|
21
|
-
import { api } from "@{{ projectName }}/backend/convex/_generated/api";
|
|
22
|
-
import { authClient } from "@/lib/auth-client";
|
|
23
|
-
import { SignIn } from "@/components/sign-in";
|
|
24
|
-
import { SignUp } from "@/components/sign-up";
|
|
25
|
-
{{else}}
|
|
26
19
|
import { useQuery } from "convex/react";
|
|
27
20
|
import { api } from "@{{ projectName }}/backend/convex/_generated/api";
|
|
28
21
|
{{/if}}
|
|
29
22
|
{{/if}}
|
|
30
|
-
{{/if}}
|
|
31
23
|
|
|
32
24
|
export default function Home() {
|
|
33
|
-
{{#if (eq api "orpc")}}
|
|
34
|
-
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
35
|
-
{{/if}}
|
|
36
|
-
{{#if (eq api "trpc")}}
|
|
37
|
-
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
38
|
-
{{/if}}
|
|
39
|
-
{{#if (eq backend "convex")}}
|
|
40
|
-
{{#if (eq auth "clerk")}}
|
|
41
|
-
const { user } = useUser();
|
|
42
|
-
const healthCheck = useQuery(api.healthCheck.get);
|
|
43
|
-
const privateData = useQuery(api.privateData.get);
|
|
44
|
-
{{else}}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const user = useQuery(api.auth.getCurrentUser, isAuthenticated ? {} : "skip");
|
|
49
|
-
{{else}}
|
|
50
|
-
const healthCheck = useQuery(api.healthCheck.get);
|
|
51
|
-
{{/if}}
|
|
52
|
-
{{/if}}
|
|
53
|
-
{{/if}}
|
|
25
|
+
{{#if (eq api "orpc")}}
|
|
26
|
+
const healthCheck = useQuery(orpc.healthCheck.queryOptions());
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#if (eq api "trpc")}}
|
|
29
|
+
const healthCheck = useQuery(trpc.healthCheck.queryOptions());
|
|
30
|
+
{{/if}}
|
|
31
|
+
{{#if (eq backend "convex")}}
|
|
32
|
+
{{#if (eq auth "clerk")}}
|
|
33
|
+
const { user } = useUser();
|
|
34
|
+
const healthCheck = useQuery(api.healthCheck.get);
|
|
35
|
+
const privateData = useQuery(api.privateData.get);
|
|
36
|
+
{{else}}
|
|
37
|
+
const healthCheck = useQuery(api.healthCheck.get);
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{/if}}
|
|
54
40
|
|
|
55
|
-
return (
|
|
56
|
-
<Container>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{{else}}
|
|
82
|
-
{{#unless (eq api "none")}}
|
|
83
|
-
<View className="flex-row items-center gap-3">
|
|
84
|
-
<View className={`h-3 w-3 rounded-full ${ healthCheck.data ? "bg-green-500" : "bg-orange-500" }`} />
|
|
85
|
-
<View className="flex-1">
|
|
86
|
-
<Text className="text-sm font-medium text-card-foreground">
|
|
87
|
-
{{#if (eq api "orpc")}}
|
|
88
|
-
ORPC
|
|
89
|
-
{{/if}}
|
|
90
|
-
{{#if (eq api "trpc")}}
|
|
91
|
-
TRPC
|
|
92
|
-
{{/if}}
|
|
93
|
-
</Text>
|
|
94
|
-
<Text className="text-xs text-muted-foreground">
|
|
95
|
-
{{#if (eq api "orpc")}}
|
|
96
|
-
{healthCheck.isLoading
|
|
97
|
-
? "Checking connection..."
|
|
98
|
-
: healthCheck.data
|
|
99
|
-
? "All systems operational"
|
|
100
|
-
: "Service unavailable"}
|
|
101
|
-
{{/if}}
|
|
102
|
-
{{#if (eq api "trpc")}}
|
|
103
|
-
{healthCheck.isLoading
|
|
104
|
-
? "Checking connection..."
|
|
105
|
-
: healthCheck.data
|
|
106
|
-
? "All systems operational"
|
|
107
|
-
: "Service unavailable"}
|
|
108
|
-
{{/if}}
|
|
109
|
-
</Text>
|
|
41
|
+
return (
|
|
42
|
+
<Container>
|
|
43
|
+
<ScrollView showsVerticalScrollIndicator={false} className="flex-1">
|
|
44
|
+
<Text className="font-mono text-foreground text-3xl font-bold mb-4">
|
|
45
|
+
BETTER T STACK
|
|
46
|
+
</Text>
|
|
47
|
+
<View className="bg-card border border-border rounded-xl p-6 mb-6 shadow-sm">
|
|
48
|
+
{{#if (eq backend "convex")}}
|
|
49
|
+
<View className="flex-row items-center gap-3">
|
|
50
|
+
<View
|
|
51
|
+
className={`h-3 w-3 rounded-full ${
|
|
52
|
+
healthCheck ? "bg-green-500" : "bg-orange-500"
|
|
53
|
+
}`}
|
|
54
|
+
/>
|
|
55
|
+
<View className="flex-1">
|
|
56
|
+
<Text className="text-sm font-medium text-card-foreground">
|
|
57
|
+
Convex
|
|
58
|
+
</Text>
|
|
59
|
+
<Text className="text-xs text-muted-foreground">
|
|
60
|
+
{healthCheck === undefined
|
|
61
|
+
? "Checking connection..."
|
|
62
|
+
: healthCheck === "OK"
|
|
63
|
+
? "All systems operational"
|
|
64
|
+
: "Service unavailable"}
|
|
65
|
+
</Text>
|
|
66
|
+
</View>
|
|
110
67
|
</View>
|
|
68
|
+
{{else}}
|
|
69
|
+
{{#unless (eq api "none")}}
|
|
70
|
+
<View className="flex-row items-center gap-3">
|
|
71
|
+
<View
|
|
72
|
+
className={`h-3 w-3 rounded-full ${
|
|
73
|
+
healthCheck.data ? "bg-green-500" : "bg-orange-500"
|
|
74
|
+
}`}
|
|
75
|
+
/>
|
|
76
|
+
<View className="flex-1">
|
|
77
|
+
<Text className="text-sm font-medium text-card-foreground">
|
|
78
|
+
{{#if (eq api "orpc")}}
|
|
79
|
+
ORPC
|
|
80
|
+
{{/if}}
|
|
81
|
+
{{#if (eq api "trpc")}}
|
|
82
|
+
TRPC
|
|
83
|
+
{{/if}}
|
|
84
|
+
</Text>
|
|
85
|
+
<Text className="text-xs text-muted-foreground">
|
|
86
|
+
{{#if (eq api "orpc")}}
|
|
87
|
+
{healthCheck.isLoading
|
|
88
|
+
? "Checking connection..."
|
|
89
|
+
: healthCheck.data
|
|
90
|
+
? "All systems operational"
|
|
91
|
+
: "Service unavailable"}
|
|
92
|
+
{{/if}}
|
|
93
|
+
{{#if (eq api "trpc")}}
|
|
94
|
+
{healthCheck.isLoading
|
|
95
|
+
? "Checking connection..."
|
|
96
|
+
: healthCheck.data
|
|
97
|
+
? "All systems operational"
|
|
98
|
+
: "Service unavailable"}
|
|
99
|
+
{{/if}}
|
|
100
|
+
</Text>
|
|
101
|
+
</View>
|
|
102
|
+
</View>
|
|
103
|
+
{{/unless}}
|
|
104
|
+
{{/if}}
|
|
111
105
|
</View>
|
|
112
|
-
{{
|
|
106
|
+
{{#if (and (eq backend "convex") (eq auth "clerk"))}}
|
|
107
|
+
<Authenticated>
|
|
108
|
+
<Text>Hello {user?.emailAddresses[0].emailAddress}</Text>
|
|
109
|
+
<Text>Private Data: {privateData?.message}</Text>
|
|
110
|
+
<SignOutButton />
|
|
111
|
+
</Authenticated>
|
|
112
|
+
<Unauthenticated>
|
|
113
|
+
<Link href="/(auth)/sign-in">
|
|
114
|
+
<Text>Sign in</Text>
|
|
115
|
+
</Link>
|
|
116
|
+
<Link href="/(auth)/sign-up">
|
|
117
|
+
<Text>Sign up</Text>
|
|
118
|
+
</Link>
|
|
119
|
+
</Unauthenticated>
|
|
120
|
+
<AuthLoading>
|
|
121
|
+
<Text>Loading...</Text>
|
|
122
|
+
</AuthLoading>
|
|
113
123
|
{{/if}}
|
|
114
|
-
</
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<Text>Private Data: {privateData?.message}</Text>
|
|
119
|
-
<SignOutButton />
|
|
120
|
-
</Authenticated>
|
|
121
|
-
<Unauthenticated>
|
|
122
|
-
<Link href="/(auth)/sign-in">
|
|
123
|
-
<Text>Sign in</Text>
|
|
124
|
-
</Link>
|
|
125
|
-
<Link href="/(auth)/sign-up">
|
|
126
|
-
<Text>Sign up</Text>
|
|
127
|
-
</Link>
|
|
128
|
-
</Unauthenticated>
|
|
129
|
-
<AuthLoading>
|
|
130
|
-
<Text>Loading...</Text>
|
|
131
|
-
</AuthLoading>
|
|
132
|
-
{{/if}}
|
|
133
|
-
{{#if (and (eq backend "convex") (eq auth "better-auth"))}}
|
|
134
|
-
{user ? (
|
|
135
|
-
<View className="mb-6 p-4 bg-card rounded-lg border border-border">
|
|
136
|
-
<View className="flex-row justify-between items-center mb-2">
|
|
137
|
-
<Text className="text-foreground text-base">
|
|
138
|
-
Welcome,{" "}
|
|
139
|
-
<Text className="font-medium">{user.name}</Text>
|
|
140
|
-
</Text>
|
|
141
|
-
</View>
|
|
142
|
-
<Text className="text-muted-foreground text-sm mb-4">
|
|
143
|
-
{user.email}
|
|
144
|
-
</Text>
|
|
145
|
-
|
|
146
|
-
<TouchableOpacity className="bg-destructive py-2 px-4 rounded-md self-start" onPress={()=> {
|
|
147
|
-
authClient.signOut();
|
|
148
|
-
}}
|
|
149
|
-
>
|
|
150
|
-
<Text className="text-white font-medium">Sign Out</Text>
|
|
151
|
-
</TouchableOpacity>
|
|
152
|
-
</View>
|
|
153
|
-
) : null}
|
|
154
|
-
<View className="mb-6 rounded-lg border border-border p-4">
|
|
155
|
-
<Text className="mb-3 font-medium text-foreground">API Status</Text>
|
|
156
|
-
<View className="flex-row items-center gap-2">
|
|
157
|
-
<View className={`h-3 w-3 rounded-full ${healthCheck ? "bg-green-500" : "bg-red-500" }`} />
|
|
158
|
-
<Text className="text-muted-foreground">
|
|
159
|
-
{healthCheck === undefined
|
|
160
|
-
? "Checking..."
|
|
161
|
-
: healthCheck === "OK"
|
|
162
|
-
? "Connected to API"
|
|
163
|
-
: "API Disconnected"}
|
|
164
|
-
</Text>
|
|
165
|
-
</View>
|
|
166
|
-
</View>
|
|
167
|
-
{!user && (
|
|
168
|
-
<>
|
|
169
|
-
<SignIn />
|
|
170
|
-
<SignUp />
|
|
171
|
-
</>
|
|
172
|
-
)}
|
|
173
|
-
{{/if}}
|
|
174
|
-
</View>
|
|
175
|
-
</ScrollView>
|
|
176
|
-
</Container>
|
|
177
|
-
);
|
|
178
|
-
}
|
|
124
|
+
</ScrollView>
|
|
125
|
+
</Container>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
@@ -2,13 +2,7 @@
|
|
|
2
2
|
import "@/polyfills";
|
|
3
3
|
{{/if}}
|
|
4
4
|
{{#if (eq backend "convex")}}
|
|
5
|
-
{{#if (eq auth "better-auth")}}
|
|
6
|
-
import { ConvexReactClient } from "convex/react";
|
|
7
|
-
import { ConvexBetterAuthProvider } from "@convex-dev/better-auth/react";
|
|
8
|
-
import { authClient } from "@/lib/auth-client";
|
|
9
|
-
{{else}}
|
|
10
5
|
import { ConvexProvider, ConvexReactClient } from "convex/react";
|
|
11
|
-
{{/if}}
|
|
12
6
|
{{#if (eq auth "clerk")}}
|
|
13
7
|
import { ClerkProvider, useAuth } from "@clerk/clerk-expo";
|
|
14
8
|
import { ConvexProviderWithClerk } from "convex/react-clerk";
|
|
@@ -104,21 +98,6 @@ export default function RootLayout() {
|
|
|
104
98
|
</ThemeProvider>
|
|
105
99
|
</ConvexProviderWithClerk>
|
|
106
100
|
</ClerkProvider>
|
|
107
|
-
{{else if (eq auth "better-auth")}}
|
|
108
|
-
<ConvexBetterAuthProvider client={convex} authClient={authClient}>
|
|
109
|
-
<ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
|
|
110
|
-
<StatusBar style={isDarkColorScheme ? "light" : "dark"} />
|
|
111
|
-
<GestureHandlerRootView style=\{{ flex: 1 }}>
|
|
112
|
-
<Stack>
|
|
113
|
-
<Stack.Screen name="(drawer)" options=\{{ headerShown: false }} />
|
|
114
|
-
<Stack.Screen
|
|
115
|
-
name="modal"
|
|
116
|
-
options=\{{ title: "Modal", presentation: "modal" }}
|
|
117
|
-
/>
|
|
118
|
-
</Stack>
|
|
119
|
-
</GestureHandlerRootView>
|
|
120
|
-
</ThemeProvider>
|
|
121
|
-
</ConvexBetterAuthProvider>
|
|
122
101
|
{{else}}
|
|
123
102
|
<ConvexProvider client={convex}>
|
|
124
103
|
<ThemeProvider value={isDarkColorScheme ? DARK_THEME : LIGHT_THEME}>
|