create-lunar-kit 0.1.1 → 0.1.2
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 +359 -0
- package/package.json +1 -1
package/README.MD
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
# create-lunar-kit
|
|
2
|
+
|
|
3
|
+
Scaffold a new React Native app with Lunar Kit and NativeWind pre-configured - the fastest way to start building beautiful mobile apps.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
Create a new Lunar Kit project with a single command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm create lunar-kit@latest
|
|
11
|
+
# or
|
|
12
|
+
pnpm create lunar-kit
|
|
13
|
+
# or
|
|
14
|
+
yarn create lunar-kit
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What You Get
|
|
18
|
+
|
|
19
|
+
A fully configured React Native + Expo project with:
|
|
20
|
+
|
|
21
|
+
✅ **Lunar Kit** - Component library pre-installed
|
|
22
|
+
✅ **NativeWind v4** - Tailwind CSS for React Native
|
|
23
|
+
✅ **Expo Router** - File-based routing
|
|
24
|
+
✅ **TypeScript** - Full type safety (optional)
|
|
25
|
+
✅ **Dark Mode** - Theme system built-in
|
|
26
|
+
✅ **Best Practices** - Organized folder structure
|
|
27
|
+
|
|
28
|
+
## Interactive Setup
|
|
29
|
+
|
|
30
|
+
When you run the command, you'll be prompted to configure your project:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
? Project name: › my-app
|
|
34
|
+
? Select a template: ›
|
|
35
|
+
❯ Default (Expo Router + NativeWind)
|
|
36
|
+
Minimal (Basic setup)
|
|
37
|
+
? Use TypeScript? › Yes / No
|
|
38
|
+
? Install dependencies? › Yes / No
|
|
39
|
+
? Package manager: ›
|
|
40
|
+
❯ pnpm
|
|
41
|
+
npm
|
|
42
|
+
yarn
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Project Structure
|
|
46
|
+
|
|
47
|
+
After scaffolding, your project will look like:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
my-app/
|
|
51
|
+
├── app/ # Expo Router pages
|
|
52
|
+
│ ├── _layout.tsx # Root layout
|
|
53
|
+
│ ├── index.tsx # Home screen
|
|
54
|
+
│ └── (tabs)/ # Tab navigation
|
|
55
|
+
├── src/
|
|
56
|
+
│ ├── components/ # Shared components
|
|
57
|
+
│ │ └── ui/ # Lunar Kit UI components
|
|
58
|
+
│ ├── lib/ # Utilities
|
|
59
|
+
│ │ └── utils.ts # Helper functions (cn)
|
|
60
|
+
│ ├── hooks/ # Custom hooks
|
|
61
|
+
│ ├── contexts/ # React contexts
|
|
62
|
+
│ └── providers/ # App providers
|
|
63
|
+
├── assets/ # Images, fonts, etc.
|
|
64
|
+
├── tailwind.config.js # Tailwind configuration
|
|
65
|
+
├── nativewind-env.d.ts # NativeWind types
|
|
66
|
+
├── app.json # Expo configuration
|
|
67
|
+
└── package.json
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Templates
|
|
71
|
+
|
|
72
|
+
### Default Template (Recommended)
|
|
73
|
+
|
|
74
|
+
Full-featured setup with:
|
|
75
|
+
- Expo Router with tab navigation
|
|
76
|
+
- NativeWind configured
|
|
77
|
+
- Theme provider with dark mode
|
|
78
|
+
- Example components and screens
|
|
79
|
+
- TypeScript ready
|
|
80
|
+
|
|
81
|
+
### Minimal Template
|
|
82
|
+
|
|
83
|
+
Bare-bones setup with:
|
|
84
|
+
- Basic Expo Router setup
|
|
85
|
+
- NativeWind configured
|
|
86
|
+
- Essential utilities only
|
|
87
|
+
- Clean slate for custom architecture
|
|
88
|
+
|
|
89
|
+
## What Happens During Scaffolding
|
|
90
|
+
|
|
91
|
+
1. **Project Creation**
|
|
92
|
+
- Creates project directory
|
|
93
|
+
- Copies template files
|
|
94
|
+
- Sets up package.json
|
|
95
|
+
|
|
96
|
+
2. **Dependencies Installation** (if selected)
|
|
97
|
+
- Installs Expo and React Native
|
|
98
|
+
- Installs NativeWind and dependencies
|
|
99
|
+
- Installs Lunar Kit packages
|
|
100
|
+
- Installs development tools
|
|
101
|
+
|
|
102
|
+
3. **Configuration**
|
|
103
|
+
- Configures TypeScript (if selected)
|
|
104
|
+
- Sets up tailwind.config.js
|
|
105
|
+
- Configures NativeWind
|
|
106
|
+
- Initializes Git repository
|
|
107
|
+
|
|
108
|
+
4. **Post-Setup**
|
|
109
|
+
- Generates type definitions
|
|
110
|
+
- Creates necessary directories
|
|
111
|
+
- Copies base components
|
|
112
|
+
|
|
113
|
+
## After Creation
|
|
114
|
+
|
|
115
|
+
Once your project is created, navigate to it and start developing:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
cd my-app
|
|
119
|
+
|
|
120
|
+
# Start the development server
|
|
121
|
+
npm start
|
|
122
|
+
# or
|
|
123
|
+
pnpm start
|
|
124
|
+
# or
|
|
125
|
+
yarn start
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Then press:
|
|
129
|
+
- `i` for iOS simulator
|
|
130
|
+
- `a` for Android emulator
|
|
131
|
+
- Scan QR code for Expo Go on your device
|
|
132
|
+
|
|
133
|
+
## Adding More Components
|
|
134
|
+
|
|
135
|
+
After setup, use the Lunar Kit CLI to add more components:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Install the CLI globally (if not already)
|
|
139
|
+
pnpm add -g @lunar-kit/cli
|
|
140
|
+
|
|
141
|
+
# Add components to your project
|
|
142
|
+
lunar-kit add button card dialog
|
|
143
|
+
|
|
144
|
+
# Or add all components
|
|
145
|
+
lunar-kit add --all
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Example Usage
|
|
149
|
+
|
|
150
|
+
After creation, you can start building immediately:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// app/index.tsx
|
|
154
|
+
import { View } from 'react-native';
|
|
155
|
+
import { Button } from '@/components/ui/button';
|
|
156
|
+
import { Card } from '@/components/ui/card';
|
|
157
|
+
import { Text } from '@/components/ui/text';
|
|
158
|
+
|
|
159
|
+
export default function HomeScreen() {
|
|
160
|
+
return (
|
|
161
|
+
<View className="flex-1 items-center justify-center p-4">
|
|
162
|
+
<Card className="w-full">
|
|
163
|
+
<Card.Header>
|
|
164
|
+
<Card.Title>Welcome to Lunar Kit!</Card.Title>
|
|
165
|
+
<Card.Description>
|
|
166
|
+
Start building your app with beautiful components
|
|
167
|
+
</Card.Description>
|
|
168
|
+
</Card.Header>
|
|
169
|
+
<Card.Content>
|
|
170
|
+
<Text>
|
|
171
|
+
This project is powered by Lunar Kit and NativeWind.
|
|
172
|
+
</Text>
|
|
173
|
+
</Card.Content>
|
|
174
|
+
<Card.Footer>
|
|
175
|
+
<Button variant="default">
|
|
176
|
+
Get Started
|
|
177
|
+
</Button>
|
|
178
|
+
</Card.Footer>
|
|
179
|
+
</Card>
|
|
180
|
+
</View>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## CLI Options
|
|
186
|
+
|
|
187
|
+
Run with options to skip interactive prompts:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Create with specific options
|
|
191
|
+
npm create lunar-kit@latest my-app -- --template default --typescript
|
|
192
|
+
|
|
193
|
+
# Available flags:
|
|
194
|
+
--template <name> Template to use (default|minimal)
|
|
195
|
+
--typescript Use TypeScript
|
|
196
|
+
--no-typescript Use JavaScript
|
|
197
|
+
--install Install dependencies
|
|
198
|
+
--no-install Skip dependency installation
|
|
199
|
+
--packageManager Package manager to use (pnpm|npm|yarn)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Examples
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# TypeScript project with pnpm
|
|
206
|
+
npm create lunar-kit@latest my-app -- --typescript --packageManager pnpm
|
|
207
|
+
|
|
208
|
+
# JavaScript project, skip install
|
|
209
|
+
npm create lunar-kit@latest my-app -- --no-typescript --no-install
|
|
210
|
+
|
|
211
|
+
# Minimal template
|
|
212
|
+
npm create lunar-kit@latest my-app -- --template minimal
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Requirements
|
|
216
|
+
|
|
217
|
+
- **Node.js**: >= 18.0.0
|
|
218
|
+
- **Package Manager**: npm, pnpm, or yarn
|
|
219
|
+
- **iOS**: Xcode 14.0+ (for iOS development)
|
|
220
|
+
- **Android**: Android Studio with SDK (for Android development)
|
|
221
|
+
|
|
222
|
+
## Features Included
|
|
223
|
+
|
|
224
|
+
### NativeWind v4
|
|
225
|
+
|
|
226
|
+
Tailwind CSS utilities work natively:
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
<View className="flex-1 bg-white dark:bg-gray-900 p-4">
|
|
230
|
+
<Text className="text-2xl font-bold text-gray-900 dark:text-white">
|
|
231
|
+
Hello World
|
|
232
|
+
</Text>
|
|
233
|
+
</View>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Dark Mode
|
|
237
|
+
|
|
238
|
+
Theme provider included:
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
import { useTheme } from '@/hooks/useTheme';
|
|
242
|
+
|
|
243
|
+
const { theme, toggleTheme } = useTheme();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Type Safety
|
|
247
|
+
|
|
248
|
+
Full TypeScript support with proper types:
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
import type { ButtonProps } from '@/components/ui/button';
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### File-based Routing
|
|
255
|
+
|
|
256
|
+
Expo Router for intuitive navigation:
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
app/
|
|
260
|
+
index.tsx → /
|
|
261
|
+
profile.tsx → /profile
|
|
262
|
+
settings/
|
|
263
|
+
index.tsx → /settings
|
|
264
|
+
account.tsx → /settings/account
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Updating
|
|
268
|
+
|
|
269
|
+
Keep your project up to date:
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Update Lunar Kit packages
|
|
273
|
+
pnpm update @lunar-kit/cli @lunar-kit/core
|
|
274
|
+
|
|
275
|
+
# Update Expo SDK
|
|
276
|
+
npx expo install --fix
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Troubleshooting
|
|
280
|
+
|
|
281
|
+
### Installation Fails
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
# Clear cache and retry
|
|
285
|
+
pnpm store prune
|
|
286
|
+
pnpm create lunar-kit
|
|
287
|
+
|
|
288
|
+
# Or use npx with npm
|
|
289
|
+
npx create-lunar-kit@latest
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### NativeWind Not Working
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
# Regenerate NativeWind setup
|
|
296
|
+
pnpm nativewind:check
|
|
297
|
+
|
|
298
|
+
# Clear Metro cache
|
|
299
|
+
pnpm start --clear
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Type Errors
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Regenerate types
|
|
306
|
+
npx expo customize tsconfig.json
|
|
307
|
+
|
|
308
|
+
# Check NativeWind types
|
|
309
|
+
cat nativewind-env.d.ts
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Differences from create-expo-app
|
|
313
|
+
|
|
314
|
+
`create-lunar-kit` extends Expo with:
|
|
315
|
+
|
|
316
|
+
- ✅ Pre-configured component library
|
|
317
|
+
- ✅ NativeWind (Tailwind CSS) setup
|
|
318
|
+
- ✅ Theme system with dark mode
|
|
319
|
+
- ✅ Better folder structure
|
|
320
|
+
- ✅ Utility functions included
|
|
321
|
+
- ✅ CLI tool for adding components
|
|
322
|
+
|
|
323
|
+
## Examples & Demos
|
|
324
|
+
|
|
325
|
+
Check out example apps in the [repository](https://github.com/yourusername/lunar-kit/tree/main/apps/example).
|
|
326
|
+
|
|
327
|
+
## Support
|
|
328
|
+
|
|
329
|
+
- [Documentation](https://github.com/yourusername/lunar-kit#readme)
|
|
330
|
+
- [Discord Community](https://discord.gg/your-invite)
|
|
331
|
+
- [GitHub Issues](https://github.com/yourusername/lunar-kit/issues)
|
|
332
|
+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/lunar-kit)
|
|
333
|
+
|
|
334
|
+
## What's Next?
|
|
335
|
+
|
|
336
|
+
After creating your project:
|
|
337
|
+
|
|
338
|
+
1. **Explore Components**: Check `src/components/ui/`
|
|
339
|
+
2. **Add More Components**: Use `lunar-kit add <component>`
|
|
340
|
+
3. **Customize Theme**: Edit `tailwind.config.js`
|
|
341
|
+
4. **Build Screens**: Add files to `app/` directory
|
|
342
|
+
5. **Deploy**: Use Expo EAS Build
|
|
343
|
+
|
|
344
|
+
## Related Packages
|
|
345
|
+
|
|
346
|
+
- [@lunar-kit/cli](../cli) - CLI for managing components
|
|
347
|
+
- [@lunar-kit/core](../core) - Core component registry
|
|
348
|
+
|
|
349
|
+
## Contributing
|
|
350
|
+
|
|
351
|
+
We welcome contributions! See [CONTRIBUTING.md](../../CONTRIBUTING.md) for guidelines.
|
|
352
|
+
|
|
353
|
+
## License
|
|
354
|
+
|
|
355
|
+
MIT © Dimas Maulana
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
**Made with 🌙 by the Lunar Kit team**
|