create-launchrail 0.0.0-stage → 0.3.1
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/README.md +39 -2
- package/THIRD_PARTY_LICENSES +43 -0
- package/bin/create-launchrail.mjs +75 -0
- package/bin/project-directory.mjs +7 -0
- package/bin/scaffold.mjs +217 -0
- package/bin/tools.mjs +62 -0
- package/bin/versions.mjs +118 -0
- package/package.json +23 -4
- package/presets/headless/web/ui/button.tsx +16 -0
- package/presets/headless/web/ui/card.tsx +25 -0
- package/template/AGENTS.md +3 -0
- package/template/README.md +3 -0
- package/template/THIRD_PARTY_LICENSES +43 -0
- package/template/apps/mobile/AGENTS.md +11 -0
- package/template/apps/mobile/App.tsx +511 -0
- package/template/apps/mobile/app.json +14 -0
- package/template/apps/mobile/components.json +22 -0
- package/template/apps/mobile/global.css +54 -0
- package/template/apps/mobile/index.ts +4 -0
- package/template/apps/mobile/metro.config.js +7 -0
- package/template/apps/mobile/package.json +47 -0
- package/template/apps/mobile/src/auth.ts +19 -0
- package/template/apps/mobile/src/components/native-controls.tsx +12 -0
- package/template/apps/mobile/src/components/ui/button.tsx +108 -0
- package/template/apps/mobile/src/components/ui/card.tsx +66 -0
- package/template/apps/mobile/src/components/ui/input.tsx +33 -0
- package/template/apps/mobile/src/components/ui/text.tsx +89 -0
- package/template/apps/mobile/src/css.d.ts +1 -0
- package/template/apps/mobile/src/lib/utils.ts +6 -0
- package/template/apps/mobile/src/query.tsx +16 -0
- package/template/apps/mobile/src/server-url.ts +20 -0
- package/template/apps/mobile/src/trpc.tsx +47 -0
- package/template/apps/mobile/src/uniwind-types.d.ts +7 -0
- package/template/apps/mobile/tsconfig.json +21 -0
- package/template/apps/web/components.json +15 -0
- package/template/apps/web/drizzle/0000_auth.sql +53 -0
- package/template/apps/web/drizzle/meta/0000_snapshot.json +374 -0
- package/template/apps/web/drizzle/meta/_journal.json +13 -0
- package/template/apps/web/drizzle.config.ts +11 -0
- package/template/apps/web/next.config.ts +11 -0
- package/template/apps/web/package.json +48 -0
- package/template/apps/web/postcss.config.mjs +3 -0
- package/template/apps/web/src/app/api/auth/[...all]/route.ts +7 -0
- package/template/apps/web/src/app/api/trpc/[trpc]/route.ts +53 -0
- package/template/apps/web/src/app/globals.css +250 -0
- package/template/apps/web/src/app/layout.tsx +31 -0
- package/template/apps/web/src/app/page.tsx +35 -0
- package/template/apps/web/src/app/starter-demo.tsx +258 -0
- package/template/apps/web/src/components/ui/button.tsx +57 -0
- package/template/apps/web/src/components/ui/card.tsx +102 -0
- package/template/apps/web/src/lib/auth-client.ts +5 -0
- package/template/apps/web/src/lib/query.tsx +23 -0
- package/template/apps/web/src/lib/trpc.tsx +29 -0
- package/template/apps/web/src/lib/utils.ts +6 -0
- package/template/apps/web/src/server/auth.ts +44 -0
- package/template/apps/web/src/server/db.ts +38 -0
- package/template/apps/web/src/server/schema.ts +87 -0
- package/template/apps/web/tsconfig.json +31 -0
- package/template/compose.yaml +18 -0
- package/template/gitignore.template +32 -0
- package/template/package.json +22 -0
- package/template/packages/api/package.json +21 -0
- package/template/packages/api/src/hello.ts +5 -0
- package/template/packages/api/src/index.ts +45 -0
- package/template/packages/api/tsconfig.json +4 -0
- package/template/pnpm-workspace.yaml +5 -0
- package/template/theme/tokens.css +40 -0
- package/template/tsconfig.base.json +14 -0
- package/template/turbo.json +12 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@launchrail/mobile",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"android": "expo start --android",
|
|
8
|
+
"build": "expo export --platform all",
|
|
9
|
+
"dev": "expo start",
|
|
10
|
+
"ios": "expo start --ios",
|
|
11
|
+
"start": "expo start",
|
|
12
|
+
"typecheck": "tsc --noEmit"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@launchrail/api": "workspace:*",
|
|
16
|
+
"@better-auth/expo": "1.7.28",
|
|
17
|
+
"@tanstack/react-query": "5.108.4",
|
|
18
|
+
"@trpc/client": "11.31.6",
|
|
19
|
+
"@trpc/server": "11.31.6",
|
|
20
|
+
"@trpc/tanstack-react-query": "11.31.6",
|
|
21
|
+
"better-auth": "1.7.28",
|
|
22
|
+
"expo": "58.1.0",
|
|
23
|
+
"expo-constants": "~58.0.16",
|
|
24
|
+
"expo-linking": "~58.0.17",
|
|
25
|
+
"expo-network": "~58.0.6",
|
|
26
|
+
"expo-secure-store": "~58.0.3",
|
|
27
|
+
"expo-status-bar": "~58.0.5",
|
|
28
|
+
"expo-web-browser": "~58.1.0",
|
|
29
|
+
"react": "19.3.0",
|
|
30
|
+
"react-native": "0.88.1",
|
|
31
|
+
"react-native-safe-area-context": "~5.11.1",
|
|
32
|
+
"superjson": "2.2.7",
|
|
33
|
+
"@expo/ui": "latest",
|
|
34
|
+
"@rn-primitives/slot": "latest",
|
|
35
|
+
"class-variance-authority": "latest",
|
|
36
|
+
"clsx": "latest",
|
|
37
|
+
"tailwind-merge": "latest",
|
|
38
|
+
"uniwind": "latest",
|
|
39
|
+
"expo-system-ui": "latest"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "24.19.4",
|
|
43
|
+
"@types/react": "19.3.3",
|
|
44
|
+
"typescript": "6.0.3",
|
|
45
|
+
"tailwindcss": "latest"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { expoClient } from "@better-auth/expo/client";
|
|
2
|
+
import { createAuthClient } from "better-auth/react";
|
|
3
|
+
import Constants from "expo-constants";
|
|
4
|
+
import * as SecureStore from "expo-secure-store";
|
|
5
|
+
import { serverUrl } from "./server-url";
|
|
6
|
+
|
|
7
|
+
const configuredScheme = Constants.expoConfig?.scheme;
|
|
8
|
+
const scheme = (Array.isArray(configuredScheme) ? configuredScheme[0] : configuredScheme) ?? "launchrail";
|
|
9
|
+
|
|
10
|
+
export const authClient = createAuthClient({
|
|
11
|
+
baseURL: serverUrl,
|
|
12
|
+
plugins: [
|
|
13
|
+
expoClient({
|
|
14
|
+
scheme,
|
|
15
|
+
storagePrefix: scheme,
|
|
16
|
+
storage: SecureStore,
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Host, Switch } from "@expo/ui";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
export function NativeControls() {
|
|
5
|
+
const [enabled, setEnabled] = useState(false);
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Host matchContents={{ vertical: true }} style={{ width: "100%" }}>
|
|
9
|
+
<Switch label="Native switch" value={enabled} onValueChange={setEnabled} />
|
|
10
|
+
</Host>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { TextClassContext } from './text';
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { Platform, Pressable } from 'react-native';
|
|
5
|
+
|
|
6
|
+
const buttonVariants = cva(
|
|
7
|
+
cn(
|
|
8
|
+
'group shrink-0 flex-row items-center justify-center gap-2 rounded-md shadow-none',
|
|
9
|
+
Platform.select({
|
|
10
|
+
web: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
11
|
+
})
|
|
12
|
+
),
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
variant: {
|
|
16
|
+
default: cn(
|
|
17
|
+
'bg-primary active:bg-primary/90 shadow-sm shadow-black/5',
|
|
18
|
+
Platform.select({ web: 'hover:bg-primary/90' })
|
|
19
|
+
),
|
|
20
|
+
destructive: cn(
|
|
21
|
+
'bg-destructive active:bg-destructive/90 dark:bg-destructive/60 shadow-sm shadow-black/5',
|
|
22
|
+
Platform.select({
|
|
23
|
+
web: 'hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40',
|
|
24
|
+
})
|
|
25
|
+
),
|
|
26
|
+
outline: cn(
|
|
27
|
+
'border-border bg-background active:bg-accent dark:bg-input/30 dark:border-input dark:active:bg-input/50 border shadow-sm shadow-black/5',
|
|
28
|
+
Platform.select({
|
|
29
|
+
web: 'hover:bg-accent dark:hover:bg-input/50',
|
|
30
|
+
})
|
|
31
|
+
),
|
|
32
|
+
secondary: cn(
|
|
33
|
+
'bg-secondary active:bg-secondary/80 shadow-sm shadow-black/5',
|
|
34
|
+
Platform.select({ web: 'hover:bg-secondary/80' })
|
|
35
|
+
),
|
|
36
|
+
ghost: cn(
|
|
37
|
+
'active:bg-accent dark:active:bg-accent/50',
|
|
38
|
+
Platform.select({ web: 'hover:bg-accent dark:hover:bg-accent/50' })
|
|
39
|
+
),
|
|
40
|
+
link: '',
|
|
41
|
+
},
|
|
42
|
+
size: {
|
|
43
|
+
default: cn('h-10 px-4 py-2 sm:h-9', Platform.select({ web: 'has-[>svg]:px-3' })),
|
|
44
|
+
sm: cn('h-9 gap-1.5 rounded-md px-3 sm:h-8', Platform.select({ web: 'has-[>svg]:px-2.5' })),
|
|
45
|
+
lg: cn('h-11 rounded-md px-6 sm:h-10', Platform.select({ web: 'has-[>svg]:px-4' })),
|
|
46
|
+
icon: 'h-10 w-10 sm:h-9 sm:w-9',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
variant: 'default',
|
|
51
|
+
size: 'default',
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const buttonTextVariants = cva(
|
|
57
|
+
cn(
|
|
58
|
+
'text-foreground text-sm font-medium',
|
|
59
|
+
Platform.select({ web: 'pointer-events-none transition-colors' })
|
|
60
|
+
),
|
|
61
|
+
{
|
|
62
|
+
variants: {
|
|
63
|
+
variant: {
|
|
64
|
+
default: 'text-primary-foreground',
|
|
65
|
+
destructive: 'text-white',
|
|
66
|
+
outline: cn(
|
|
67
|
+
'group-active:text-accent-foreground',
|
|
68
|
+
Platform.select({ web: 'group-hover:text-accent-foreground' })
|
|
69
|
+
),
|
|
70
|
+
secondary: 'text-secondary-foreground',
|
|
71
|
+
ghost: 'group-active:text-accent-foreground',
|
|
72
|
+
link: cn(
|
|
73
|
+
'text-primary group-active:underline',
|
|
74
|
+
Platform.select({ web: 'underline-offset-4 hover:underline group-hover:underline' })
|
|
75
|
+
),
|
|
76
|
+
},
|
|
77
|
+
size: {
|
|
78
|
+
default: '',
|
|
79
|
+
sm: '',
|
|
80
|
+
lg: '',
|
|
81
|
+
icon: '',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
variant: 'default',
|
|
86
|
+
size: 'default',
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
type ButtonProps = React.ComponentProps<typeof Pressable> &
|
|
92
|
+
React.RefAttributes<typeof Pressable> &
|
|
93
|
+
VariantProps<typeof buttonVariants>;
|
|
94
|
+
|
|
95
|
+
function Button({ className, variant, size, ...props }: ButtonProps) {
|
|
96
|
+
return (
|
|
97
|
+
<TextClassContext.Provider value={buttonTextVariants({ variant, size })}>
|
|
98
|
+
<Pressable
|
|
99
|
+
className={cn(props.disabled && 'opacity-50', buttonVariants({ variant, size }), className)}
|
|
100
|
+
role="button"
|
|
101
|
+
{...props}
|
|
102
|
+
/>
|
|
103
|
+
</TextClassContext.Provider>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { Button, buttonTextVariants, buttonVariants };
|
|
108
|
+
export type { ButtonProps };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Text, TextClassContext } from './text';
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
function Card({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof View> & React.RefAttributes<View>) {
|
|
9
|
+
return (
|
|
10
|
+
<TextClassContext.Provider value="text-card-foreground">
|
|
11
|
+
<View
|
|
12
|
+
className={cn(
|
|
13
|
+
'bg-card border-border flex flex-col gap-6 rounded-xl border py-6 shadow-sm shadow-black/5',
|
|
14
|
+
className
|
|
15
|
+
)}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
</TextClassContext.Provider>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function CardHeader({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}: React.ComponentProps<typeof View> & React.RefAttributes<View>) {
|
|
26
|
+
return <View className={cn('flex flex-col gap-1.5 px-6', className)} {...props} />;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function CardTitle({
|
|
30
|
+
className,
|
|
31
|
+
ref,
|
|
32
|
+
...props
|
|
33
|
+
}: React.ComponentProps<typeof Text> & React.RefAttributes<typeof Text>) {
|
|
34
|
+
return (
|
|
35
|
+
<Text
|
|
36
|
+
ref={ref}
|
|
37
|
+
role="heading"
|
|
38
|
+
aria-level={3}
|
|
39
|
+
className={cn('font-semibold leading-none', className)}
|
|
40
|
+
{...props}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function CardDescription({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}: React.ComponentProps<typeof Text> & React.RefAttributes<typeof Text>) {
|
|
49
|
+
return <Text className={cn('text-muted-foreground text-sm', className)} {...props} />;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function CardContent({
|
|
53
|
+
className,
|
|
54
|
+
...props
|
|
55
|
+
}: React.ComponentProps<typeof View> & React.RefAttributes<View>) {
|
|
56
|
+
return <View className={cn('px-6', className)} {...props} />;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function CardFooter({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}: React.ComponentProps<typeof View> & React.RefAttributes<View>) {
|
|
63
|
+
return <View className={cn('flex flex-row items-center px-6', className)} {...props} />;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn } from '../../lib/utils';
|
|
2
|
+
import { Platform, TextInput } from 'react-native';
|
|
3
|
+
|
|
4
|
+
function Input({
|
|
5
|
+
className,
|
|
6
|
+
placeholderTextColorClassName = 'text-muted-foreground',
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentProps<typeof TextInput> & React.RefAttributes<TextInput>) {
|
|
9
|
+
return (
|
|
10
|
+
<TextInput
|
|
11
|
+
className={cn(
|
|
12
|
+
'dark:bg-input/30 border-input bg-background text-foreground flex h-10 w-full min-w-0 flex-row items-center rounded-md border px-3 py-1 text-base leading-5 shadow-sm shadow-black/5 sm:h-9',
|
|
13
|
+
props.editable === false &&
|
|
14
|
+
cn(
|
|
15
|
+
'opacity-50',
|
|
16
|
+
Platform.select({ web: 'disabled:pointer-events-none disabled:cursor-not-allowed' })
|
|
17
|
+
),
|
|
18
|
+
Platform.select({
|
|
19
|
+
web: cn(
|
|
20
|
+
'placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground outline-none transition-[color,box-shadow] md:text-sm',
|
|
21
|
+
'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]',
|
|
22
|
+
'aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive'
|
|
23
|
+
),
|
|
24
|
+
}),
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
placeholderTextColorClassName={placeholderTextColorClassName}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { Input };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { cn } from '../../lib/utils';
|
|
2
|
+
import { Slot } from '@rn-primitives/slot';
|
|
3
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { Platform, Text as RNText, type Role } from 'react-native';
|
|
6
|
+
|
|
7
|
+
const textVariants = cva(
|
|
8
|
+
cn(
|
|
9
|
+
'text-foreground text-base',
|
|
10
|
+
Platform.select({
|
|
11
|
+
web: 'select-text',
|
|
12
|
+
})
|
|
13
|
+
),
|
|
14
|
+
{
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
default: '',
|
|
18
|
+
h1: cn(
|
|
19
|
+
'text-center text-4xl font-extrabold tracking-tight',
|
|
20
|
+
Platform.select({ web: 'scroll-m-20 text-balance' })
|
|
21
|
+
),
|
|
22
|
+
h2: cn(
|
|
23
|
+
'border-border border-b pb-2 text-3xl font-semibold tracking-tight',
|
|
24
|
+
Platform.select({ web: 'scroll-m-20 first:mt-0' })
|
|
25
|
+
),
|
|
26
|
+
h3: cn('text-2xl font-semibold tracking-tight', Platform.select({ web: 'scroll-m-20' })),
|
|
27
|
+
h4: cn('text-xl font-semibold tracking-tight', Platform.select({ web: 'scroll-m-20' })),
|
|
28
|
+
p: 'mt-3 leading-7 sm:mt-6',
|
|
29
|
+
blockquote: 'mt-4 border-l-2 pl-3 italic sm:mt-6 sm:pl-6',
|
|
30
|
+
code: cn(
|
|
31
|
+
'bg-muted relative rounded px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold'
|
|
32
|
+
),
|
|
33
|
+
lead: 'text-muted-foreground text-xl',
|
|
34
|
+
large: 'text-lg font-semibold',
|
|
35
|
+
small: 'text-sm font-medium leading-none',
|
|
36
|
+
muted: 'text-muted-foreground text-sm',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: 'default',
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
type TextVariantProps = VariantProps<typeof textVariants>;
|
|
46
|
+
|
|
47
|
+
type TextVariant = NonNullable<TextVariantProps['variant']>;
|
|
48
|
+
|
|
49
|
+
const ROLE: Partial<Record<TextVariant, Role>> = {
|
|
50
|
+
h1: 'heading',
|
|
51
|
+
h2: 'heading',
|
|
52
|
+
h3: 'heading',
|
|
53
|
+
h4: 'heading',
|
|
54
|
+
blockquote: Platform.select({ web: 'blockquote' as Role }),
|
|
55
|
+
code: Platform.select({ web: 'code' as Role }),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const ARIA_LEVEL: Partial<Record<TextVariant, string>> = {
|
|
59
|
+
h1: '1',
|
|
60
|
+
h2: '2',
|
|
61
|
+
h3: '3',
|
|
62
|
+
h4: '4',
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const TextClassContext = React.createContext<string | undefined>(undefined);
|
|
66
|
+
|
|
67
|
+
function Text({
|
|
68
|
+
className,
|
|
69
|
+
asChild = false,
|
|
70
|
+
variant = 'default',
|
|
71
|
+
...props
|
|
72
|
+
}: React.ComponentProps<typeof RNText> &
|
|
73
|
+
React.RefAttributes<typeof RNText> &
|
|
74
|
+
TextVariantProps & {
|
|
75
|
+
asChild?: boolean;
|
|
76
|
+
}) {
|
|
77
|
+
const textClass = React.useContext(TextClassContext);
|
|
78
|
+
const Component = asChild ? Slot : RNText;
|
|
79
|
+
return (
|
|
80
|
+
<Component
|
|
81
|
+
className={cn(textVariants({ variant }), textClass, className)}
|
|
82
|
+
role={variant ? ROLE[variant] : undefined}
|
|
83
|
+
aria-level={variant ? ARIA_LEVEL[variant] : undefined}
|
|
84
|
+
{...props}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { Text, TextClassContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module "*.css";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { type PropsWithChildren, useState } from "react";
|
|
3
|
+
import { Text } from "react-native";
|
|
4
|
+
|
|
5
|
+
export function QueryProvider({ children }: PropsWithChildren) {
|
|
6
|
+
const [client] = useState(() => new QueryClient());
|
|
7
|
+
return <QueryClientProvider client={client}>{children}</QueryClientProvider>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function QueryDemo() {
|
|
11
|
+
const query = useQuery({
|
|
12
|
+
queryKey: ["starter"],
|
|
13
|
+
queryFn: async () => "TanStack Query is ready.",
|
|
14
|
+
});
|
|
15
|
+
return <Text accessibilityLiveRegion="polite">{query.data ?? "Loading…"}</Text>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Constants from "expo-constants";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
|
|
4
|
+
const metroHost = Constants.expoConfig?.hostUri?.split(":")[0];
|
|
5
|
+
const hasLanHost = metroHost && !["localhost", "127.0.0.1"].includes(metroHost);
|
|
6
|
+
const localHost = hasLanHost
|
|
7
|
+
? metroHost
|
|
8
|
+
: Platform.OS === "android"
|
|
9
|
+
? "10.0.2.2"
|
|
10
|
+
: "localhost";
|
|
11
|
+
|
|
12
|
+
const configuredUrl: string =
|
|
13
|
+
process.env.EXPO_PUBLIC_API_URL?.trim() || "http://localhost:3000";
|
|
14
|
+
|
|
15
|
+
export const serverUrl = configuredUrl
|
|
16
|
+
.replace(
|
|
17
|
+
/^(https?:\/\/)(?:localhost|127\.0\.0\.1)(?=[:/]|$)/,
|
|
18
|
+
(_match, protocol: string) => `${protocol}${localHost}`,
|
|
19
|
+
)
|
|
20
|
+
.replace(/\/+$/, "");
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AppRouter } from "@launchrail/api";
|
|
2
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
3
|
+
import { createTRPCClient, httpBatchLink } from "@trpc/client";
|
|
4
|
+
import { createTRPCContext } from "@trpc/tanstack-react-query";
|
|
5
|
+
import { type PropsWithChildren, useState } from "react";
|
|
6
|
+
import superjson from "superjson";
|
|
7
|
+
/* @if auth */
|
|
8
|
+
import { authClient } from "./auth";
|
|
9
|
+
/* @end */
|
|
10
|
+
import { serverUrl } from "./server-url";
|
|
11
|
+
|
|
12
|
+
const { TRPCProvider, useTRPC } = createTRPCContext<AppRouter>();
|
|
13
|
+
|
|
14
|
+
export { useTRPC };
|
|
15
|
+
|
|
16
|
+
export function ApiProvider({ children }: PropsWithChildren) {
|
|
17
|
+
const [queryClient] = useState(
|
|
18
|
+
() => new QueryClient({ defaultOptions: { queries: { retry: false } } }),
|
|
19
|
+
);
|
|
20
|
+
const [trpcClient] = useState(() =>
|
|
21
|
+
createTRPCClient<AppRouter>({
|
|
22
|
+
links: [
|
|
23
|
+
httpBatchLink({
|
|
24
|
+
url: `${serverUrl}/api/trpc`,
|
|
25
|
+
transformer: superjson,
|
|
26
|
+
/* @if auth */
|
|
27
|
+
async headers() {
|
|
28
|
+
const cookie = await authClient.getCookie();
|
|
29
|
+
return cookie ? { Cookie: cookie } : {};
|
|
30
|
+
},
|
|
31
|
+
fetch(url, options) {
|
|
32
|
+
return fetch(url, { ...options, credentials: "omit" });
|
|
33
|
+
},
|
|
34
|
+
/* @end */
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
}),
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<QueryClientProvider client={queryClient}>
|
|
42
|
+
<TRPCProvider queryClient={queryClient} trpcClient={trpcClient}>
|
|
43
|
+
{children}
|
|
44
|
+
</TRPCProvider>
|
|
45
|
+
</QueryClientProvider>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "expo/tsconfig.base",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"strict": true,
|
|
5
|
+
"noUncheckedIndexedAccess": true,
|
|
6
|
+
"types": [
|
|
7
|
+
"node"
|
|
8
|
+
],
|
|
9
|
+
"paths": {
|
|
10
|
+
"@/*": [
|
|
11
|
+
"./src/*"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"include": [
|
|
16
|
+
"index.ts",
|
|
17
|
+
"App.tsx",
|
|
18
|
+
"src/**/*.ts",
|
|
19
|
+
"src/**/*.tsx"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "base-nova",
|
|
4
|
+
"rsc": true,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": { "config": "", "css": "src/app/globals.css", "baseColor": "neutral", "cssVariables": true },
|
|
7
|
+
"iconLibrary": "lucide",
|
|
8
|
+
"aliases": {
|
|
9
|
+
"components": "@/components",
|
|
10
|
+
"ui": "@/components/ui",
|
|
11
|
+
"utils": "@/lib/utils",
|
|
12
|
+
"lib": "@/lib",
|
|
13
|
+
"hooks": "@/hooks"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
CREATE TABLE "account" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"account_id" text NOT NULL,
|
|
4
|
+
"provider_id" text NOT NULL,
|
|
5
|
+
"user_id" text NOT NULL,
|
|
6
|
+
"access_token" text,
|
|
7
|
+
"refresh_token" text,
|
|
8
|
+
"id_token" text,
|
|
9
|
+
"access_token_expires_at" timestamp,
|
|
10
|
+
"refresh_token_expires_at" timestamp,
|
|
11
|
+
"scope" text,
|
|
12
|
+
"password" text,
|
|
13
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
14
|
+
"updated_at" timestamp NOT NULL
|
|
15
|
+
);
|
|
16
|
+
--> statement-breakpoint
|
|
17
|
+
CREATE TABLE "session" (
|
|
18
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
19
|
+
"expires_at" timestamp NOT NULL,
|
|
20
|
+
"token" text NOT NULL,
|
|
21
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
22
|
+
"updated_at" timestamp NOT NULL,
|
|
23
|
+
"ip_address" text,
|
|
24
|
+
"user_agent" text,
|
|
25
|
+
"user_id" text NOT NULL,
|
|
26
|
+
CONSTRAINT "session_token_unique" UNIQUE("token")
|
|
27
|
+
);
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
CREATE TABLE "user" (
|
|
30
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
31
|
+
"name" text NOT NULL,
|
|
32
|
+
"email" text NOT NULL,
|
|
33
|
+
"email_verified" boolean DEFAULT false NOT NULL,
|
|
34
|
+
"image" text,
|
|
35
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
36
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
37
|
+
CONSTRAINT "user_email_unique" UNIQUE("email")
|
|
38
|
+
);
|
|
39
|
+
--> statement-breakpoint
|
|
40
|
+
CREATE TABLE "verification" (
|
|
41
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
42
|
+
"identifier" text NOT NULL,
|
|
43
|
+
"value" text NOT NULL,
|
|
44
|
+
"expires_at" timestamp NOT NULL,
|
|
45
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
46
|
+
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
47
|
+
);
|
|
48
|
+
--> statement-breakpoint
|
|
49
|
+
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
50
|
+
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
|
51
|
+
CREATE INDEX "account_user_id_idx" ON "account" USING btree ("user_id");--> statement-breakpoint
|
|
52
|
+
CREATE INDEX "session_user_id_idx" ON "session" USING btree ("user_id");--> statement-breakpoint
|
|
53
|
+
CREATE INDEX "verification_identifier_idx" ON "verification" USING btree ("identifier");
|