create-better-t-stack 3.1.8-canary.65dbf382 → 3.1.8-canary.932e5243
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-better-t-stack",
|
|
3
|
-
"version": "3.1.8-canary.
|
|
3
|
+
"version": "3.1.8-canary.932e5243",
|
|
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",
|
|
@@ -11,51 +11,47 @@ import { components } from "./_generated/api";
|
|
|
11
11
|
import { DataModel } from "./_generated/dataModel";
|
|
12
12
|
import { query } from "./_generated/server";
|
|
13
13
|
import { betterAuth } from "better-auth";
|
|
14
|
-
import { v } from "convex/values";
|
|
15
14
|
|
|
16
|
-
{{#unless (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
17
15
|
const siteUrl = process.env.SITE_URL!;
|
|
18
|
-
{{/unless}}
|
|
19
16
|
|
|
20
17
|
export const authComponent = createClient<DataModel>(components.betterAuth);
|
|
21
18
|
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
19
|
+
export const createAuth = (
|
|
20
|
+
ctx: GenericCtx<DataModel>,
|
|
21
|
+
{ optionsOnly } = { optionsOnly: false },
|
|
22
|
+
) => {
|
|
23
|
+
return betterAuth({
|
|
24
|
+
logger: {
|
|
25
|
+
disabled: optionsOnly,
|
|
26
|
+
},
|
|
27
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
28
|
+
trustedOrigins: ["mybettertapp://"],
|
|
29
|
+
{{else if (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
30
|
+
baseURL: siteUrl,
|
|
31
|
+
trustedOrigins: [siteUrl],
|
|
32
|
+
{{else}}
|
|
33
|
+
trustedOrigins: [siteUrl],
|
|
34
|
+
{{/if}}
|
|
35
|
+
database: authComponent.adapter(ctx),
|
|
36
|
+
emailAndPassword: {
|
|
37
|
+
enabled: true,
|
|
38
|
+
requireEmailVerification: false,
|
|
39
|
+
},
|
|
40
|
+
plugins: [
|
|
41
|
+
{{#if (or (includes frontend "native-nativewind") (includes frontend "native-unistyles"))}}
|
|
42
|
+
expo(),
|
|
43
|
+
{{/if}}
|
|
44
|
+
{{#unless (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
45
|
+
crossDomain({ siteUrl }),
|
|
46
|
+
{{/unless}}
|
|
47
|
+
convex(),
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
};
|
|
54
51
|
|
|
55
52
|
export const getCurrentUser = query({
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
53
|
+
args: {},
|
|
54
|
+
handler: async (ctx) => {
|
|
55
|
+
return authComponent.getAuthUser(ctx);
|
|
56
|
+
},
|
|
57
|
+
});
|
|
@@ -3,7 +3,7 @@ import { authComponent, createAuth } from "./auth";
|
|
|
3
3
|
|
|
4
4
|
const http = httpRouter();
|
|
5
5
|
|
|
6
|
-
{{#if (or (includes frontend "tanstack-start") (includes frontend "next")
|
|
6
|
+
{{#if (or (includes frontend "tanstack-start") (includes frontend "next"))}}
|
|
7
7
|
authComponent.registerRoutes(http, createAuth);
|
|
8
8
|
{{else}}
|
|
9
9
|
authComponent.registerRoutes(http, createAuth, { cors: true });
|