@trailer-park-oss/create-rn-ai-starter 0.1.0
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 +174 -0
- package/dist/index.js +680 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
- package/templates/auth/app/(auth)/_layout.tsx +17 -0
- package/templates/auth/app/(auth)/forgot-password.tsx.ejs +203 -0
- package/templates/auth/app/(auth)/sign-in.tsx.ejs +257 -0
- package/templates/auth/app/(auth)/sign-up.tsx.ejs +286 -0
- package/templates/auth/app/(auth)/verify-email.tsx.ejs +214 -0
- package/templates/auth/src/providers/auth/AuthGate.tsx +22 -0
- package/templates/auth/src/providers/auth/AuthProviderWrapper.tsx +10 -0
- package/templates/auth/src/providers/auth/auth.interface.ts +63 -0
- package/templates/auth/src/providers/auth/auth.schemas.ts +28 -0
- package/templates/auth/src/providers/auth/clerk/clerk-adapter.ts +235 -0
- package/templates/auth/src/providers/auth/clerk/clerk-provider.tsx +16 -0
- package/templates/auth/src/providers/auth/clerk/env.ts +21 -0
- package/templates/auth/src/providers/auth/clerk/index.ts +5 -0
- package/templates/auth/src/providers/auth/clerk/token-cache.ts +32 -0
- package/templates/auth/src/providers/auth/clerk/use-warm-up-browser.ts +11 -0
- package/templates/auth/src/providers/auth/index.ts +23 -0
- package/templates/auth/src/providers/auth/useAuth.ts +6 -0
- package/templates/core/app/(app)/_layout.tsx.ejs +54 -0
- package/templates/core/app/(app)/index.tsx.ejs +36 -0
- package/templates/core/app/(app)/profile.tsx.ejs +36 -0
- package/templates/core/app/(app)/settings.tsx.ejs +36 -0
- package/templates/core/app/(onboarding)/_layout.tsx +12 -0
- package/templates/core/app/(onboarding)/features.tsx.ejs +45 -0
- package/templates/core/app/(onboarding)/get-started.tsx.ejs +48 -0
- package/templates/core/app/(onboarding)/welcome.tsx.ejs +44 -0
- package/templates/core/app/_layout.tsx.ejs +33 -0
- package/templates/core/app/index.tsx.ejs +25 -0
- package/templates/core/app.json.ejs +20 -0
- package/templates/core/babel.config.js +7 -0
- package/templates/core/src/lib/query-client.ts +11 -0
- package/templates/core/src/providers/auth/index.ts.ejs +25 -0
- package/templates/core/src/providers/payments/index.ts.ejs +25 -0
- package/templates/core/src/providers/ui/index.ts.ejs +17 -0
- package/templates/core/src/starter.config.ts.ejs +21 -0
- package/templates/core/src/store/index.ts +2 -0
- package/templates/core/src/store/onboarding.ts +13 -0
- package/templates/core/src/store/theme.ts.ejs +12 -0
- package/templates/core/tsconfig.json.ejs +10 -0
- package/templates/ui/src/design-system/ThemeProvider.tsx.ejs +79 -0
- package/templates/ui/src/design-system/elevation.ts +51 -0
- package/templates/ui/src/design-system/index.ts +13 -0
- package/templates/ui/src/design-system/tokens.ts +199 -0
- package/templates/ui/src/lib/storage.ts +4 -0
- package/templates/ui/src/store/theme.ts.ejs +28 -0
- package/templates/ui-gluestack/src/components/Card.tsx +76 -0
- package/templates/ui-gluestack/src/components/PrimaryButton.tsx +71 -0
- package/templates/ui-gluestack/src/components/StatusBanner.tsx +44 -0
- package/templates/ui-gluestack/src/providers/ui/gluestack/GluestackProvider.tsx +19 -0
- package/templates/ui-gluestack/src/providers/ui/gluestack/gluestack.config.ts +55 -0
- package/templates/ui-gluestack/src/providers/ui/gluestack/index.ts +2 -0
- package/templates/ui-tamagui/src/components/Card.tsx +76 -0
- package/templates/ui-tamagui/src/components/PrimaryButton.tsx +71 -0
- package/templates/ui-tamagui/src/components/StatusBanner.tsx +43 -0
- package/templates/ui-tamagui/src/providers/ui/tamagui/TamaguiProvider.tsx +18 -0
- package/templates/ui-tamagui/src/providers/ui/tamagui/index.ts +2 -0
- package/templates/ui-tamagui/src/providers/ui/tamagui/tamagui.config.ts +96 -0
- package/templates/ui-tamagui/tamagui.config.ts +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# create-rn-ai-starter
|
|
2
|
+
|
|
3
|
+
CLI to scaffold Expo React Native projects with modular feature packs.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx create-rn-ai-starter my-app
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This launches an interactive wizard that walks you through each option. To skip prompts and accept all defaults:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx create-rn-ai-starter my-app --yes
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
create-rn-ai-starter <project-path> [options]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The `<project-path>` argument can be a plain name, a relative path, an absolute path, or `.` to scaffold in the current (empty) directory. The project name is derived from the last segment of the path.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx create-rn-ai-starter my-app # creates ./my-app
|
|
27
|
+
npx create-rn-ai-starter ./projects/my-app # creates ./projects/my-app
|
|
28
|
+
npx create-rn-ai-starter /absolute/path/my-app # creates /absolute/path/my-app
|
|
29
|
+
npx create-rn-ai-starter . # scaffolds in cwd (must be empty)
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Options
|
|
33
|
+
|
|
34
|
+
| Flag | Values | Default |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| `--ui <provider>` | `tamagui` \| `gluestack` | `tamagui` |
|
|
37
|
+
| `--auth <provider>` | `clerk` \| `none` | `none` |
|
|
38
|
+
| `--payments <provider>` | `stripe` \| `none` | `none` |
|
|
39
|
+
| `--dx <profile>` | `basic` \| `full` | `basic` |
|
|
40
|
+
| `--preset <theme>` | `neutral-green` \| `fluent-blue` | `neutral-green` |
|
|
41
|
+
| `--yes` | — | Skip prompts, use defaults for unset flags |
|
|
42
|
+
|
|
43
|
+
### Examples
|
|
44
|
+
|
|
45
|
+
Scaffold with all defaults (no prompts):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npx create-rn-ai-starter my-app --yes
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Pick specific providers:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx create-rn-ai-starter my-app --ui gluestack --auth clerk --payments stripe
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Mix flags with interactive prompts for the rest:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx create-rn-ai-starter my-app --ui tamagui --dx full
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Scaffold inside an existing projects folder:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx create-rn-ai-starter ./work/my-app --yes
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Scaffold in the current directory:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
mkdir my-app && cd my-app
|
|
73
|
+
npx create-rn-ai-starter . --yes
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## What Gets Generated
|
|
77
|
+
|
|
78
|
+
The CLI creates a new Expo project with:
|
|
79
|
+
|
|
80
|
+
- **Core** — Expo Router file-based routing, onboarding flow (3 screens), tab navigation (Home, Profile, Settings), Zustand stores, React Query setup, provider resolvers, and a `starter.config.ts` manifest.
|
|
81
|
+
- **UI** — Full design system with canonical tokens (colors, spacing, radius, typography), `ThemeProvider` with animated transitions, MMKV-persisted theme store, and library-specific components (Card, PrimaryButton, StatusBanner). Screens import directly from the selected UI library via the kit pattern — `tamagui` or `@gluestack-ui/themed`.
|
|
82
|
+
- **Auth** — Auth provider wiring and `(auth)` route group (when not `none`).
|
|
83
|
+
- **Payments** — Payments provider wiring (when not `none`).
|
|
84
|
+
- **DX** — Developer experience profile (linting, formatting, TypeScript strictness).
|
|
85
|
+
|
|
86
|
+
After scaffolding, the CLI installs dependencies and runs validation checks to make sure everything is wired correctly.
|
|
87
|
+
|
|
88
|
+
### UI library selection
|
|
89
|
+
|
|
90
|
+
Screens use the selected library's components directly — no abstraction layer:
|
|
91
|
+
|
|
92
|
+
- `--ui tamagui` → screens import `YStack`, `Text` from `'tamagui'`
|
|
93
|
+
- `--ui gluestack` → screens import `VStack`, `Text` from `'@gluestack-ui/themed'`
|
|
94
|
+
|
|
95
|
+
This is powered by a **kit pattern** in the CLI templates: a plain object maps component names and import paths per library, so screen templates are written once with EJS variables and produce clean, idiomatic output for each library.
|
|
96
|
+
|
|
97
|
+
### Theme presets
|
|
98
|
+
|
|
99
|
+
Both presets include light and dark mode palettes:
|
|
100
|
+
|
|
101
|
+
- `--preset neutral-green` — gray scale + green accent (#22C55E)
|
|
102
|
+
- `--preset fluent-blue` — Fluent-style blues (#0078D4)
|
|
103
|
+
|
|
104
|
+
Theme selection persists across app restarts via MMKV + Zustand persist middleware.
|
|
105
|
+
|
|
106
|
+
## Generated Project Structure
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
my-app/
|
|
110
|
+
├── app/
|
|
111
|
+
│ ├── _layout.tsx # Root layout — SafeAreaProvider, QueryClient, ThemeProvider
|
|
112
|
+
│ ├── index.tsx # Entry redirect (splash handling)
|
|
113
|
+
│ ├── (onboarding)/
|
|
114
|
+
│ │ ├── _layout.tsx # Stack navigator
|
|
115
|
+
│ │ ├── welcome.tsx # Uses YStack/VStack + design tokens
|
|
116
|
+
│ │ ├── features.tsx
|
|
117
|
+
│ │ └── get-started.tsx
|
|
118
|
+
│ ├── (app)/
|
|
119
|
+
│ │ ├── _layout.tsx # Tab navigator (Home, Profile, Settings)
|
|
120
|
+
│ │ ├── index.tsx
|
|
121
|
+
│ │ ├── profile.tsx
|
|
122
|
+
│ │ └── settings.tsx
|
|
123
|
+
│ └── (auth)/ # (generated when auth ≠ none)
|
|
124
|
+
│ └── _layout.tsx
|
|
125
|
+
├── src/
|
|
126
|
+
│ ├── starter.config.ts # Selected providers & modes
|
|
127
|
+
│ ├── design-system/
|
|
128
|
+
│ │ ├── index.ts # Barrel export (resolveTokens, useTokens, ThemeProvider, elevation)
|
|
129
|
+
│ │ ├── tokens.ts # Canonical tokens — colors, spacing, radius, typography
|
|
130
|
+
│ │ ├── ThemeProvider.tsx # Reads store, resolves tokens, animated theme transitions
|
|
131
|
+
│ │ └── elevation.ts # Platform-aware card/modal/toast shadows
|
|
132
|
+
│ ├── components/
|
|
133
|
+
│ │ ├── Card.tsx # Animated card with haptics — uses tamagui or gluestack directly
|
|
134
|
+
│ │ ├── PrimaryButton.tsx # Animated button with haptics
|
|
135
|
+
│ │ └── StatusBanner.tsx # Success/warning/critical/info banners
|
|
136
|
+
│ ├── store/
|
|
137
|
+
│ │ ├── index.ts # Barrel export
|
|
138
|
+
│ │ ├── onboarding.ts # Zustand — onboarding state
|
|
139
|
+
│ │ └── theme.ts # Zustand + MMKV persist — preset & colorMode
|
|
140
|
+
│ ├── lib/
|
|
141
|
+
│ │ ├── query-client.ts # TanStack Query client
|
|
142
|
+
│ │ └── mmkv-storage.ts # MMKV instance + Zustand StateStorage adapter
|
|
143
|
+
│ └── providers/
|
|
144
|
+
│ ├── ui/
|
|
145
|
+
│ │ ├── index.ts # Resolver — tamagui or gluestack
|
|
146
|
+
│ │ └── tamagui/ # (or gluestack/) — library-specific config & provider
|
|
147
|
+
│ ├── auth/index.ts # Resolver — clerk or no-op stub
|
|
148
|
+
│ └── payments/index.ts # Resolver — stripe or no-op stub
|
|
149
|
+
├── tamagui.config.ts # (only when --ui tamagui)
|
|
150
|
+
├── app.json
|
|
151
|
+
├── tsconfig.json # strict, noUncheckedIndexedAccess, @/* alias
|
|
152
|
+
└── package.json
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## After Scaffolding
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
cd my-app
|
|
159
|
+
npx expo start
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm install
|
|
166
|
+
npm run build # compile with tsup
|
|
167
|
+
npm run dev # compile in watch mode
|
|
168
|
+
npm test # run tests with vitest
|
|
169
|
+
npm run typecheck # type-check without emitting
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Requirements
|
|
173
|
+
|
|
174
|
+
- Node.js >= 18
|