create-lunar-kit 0.1.1 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.MD +359 -0
  2. package/dist/index.js +65 -74
  3. package/package.json +2 -2
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**
package/dist/index.js CHANGED
@@ -1,12 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // ../../node_modules/.pnpm/tsup@8.5.1_jiti@1.21.7_postcss@8.4.49_typescript@5.9.3_yaml@2.8.2/node_modules/tsup/assets/esm_shims.js
4
- import path from "path";
5
- import { fileURLToPath } from "url";
6
- var getFilename = () => fileURLToPath(import.meta.url);
7
- var getDirname = () => path.dirname(getFilename());
8
- var __dirname = /* @__PURE__ */ getDirname();
9
-
10
3
  // src/index.ts
11
4
  import { Command } from "commander";
12
5
  import prompts from "prompts";
@@ -14,8 +7,8 @@ import chalk3 from "chalk";
14
7
  import ora from "ora";
15
8
  import { execa } from "execa";
16
9
  import fs2 from "fs-extra";
17
- import path3 from "path";
18
- import { fileURLToPath as fileURLToPath2 } from "url";
10
+ import path2 from "path";
11
+ import { fileURLToPath } from "url";
19
12
 
20
13
  // src/assets/logo.ts
21
14
  import chalk from "chalk";
@@ -64,9 +57,8 @@ var renderLogo = () => {
64
57
 
65
58
  // src/commands/init.ts
66
59
  import fs from "fs-extra";
67
- import path2 from "path";
68
- var COMPONENTS_SOURCE = path2.join(__dirname, "../..", "src", "components");
69
- var SOURCE = path2.join(__dirname, "../..", "src");
60
+ import path from "path";
61
+ import { LOCAL_COMPONENTS_PATH, LOCAL_SOURCE_PATH } from "@lunar-kit/core";
70
62
  async function createSrcStructure(projectPath, navigation) {
71
63
  const dirs = [
72
64
  "src/modules",
@@ -78,42 +70,42 @@ async function createSrcStructure(projectPath, navigation) {
78
70
  "src/types"
79
71
  ];
80
72
  for (const dir of dirs) {
81
- await fs.ensureDir(path2.join(projectPath, dir));
73
+ await fs.ensureDir(path.join(projectPath, dir));
82
74
  }
83
- await createBarrelExport(path2.join(projectPath, "src/components"), "index.ts");
84
- await createBarrelExport(path2.join(projectPath, "src/hooks"), "index.ts");
85
- await createBarrelExport(path2.join(projectPath, "src/stores"), "index.ts");
75
+ await createBarrelExport(path.join(projectPath, "src/components"), "index.ts");
76
+ await createBarrelExport(path.join(projectPath, "src/hooks"), "index.ts");
77
+ await createBarrelExport(path.join(projectPath, "src/stores"), "index.ts");
86
78
  }
87
79
  async function createBarrelExport(dir, filename) {
88
80
  const content = `// Auto-generated barrel export
89
81
  // This file is managed by Lunar Kit CLI
90
82
  `;
91
- await fs.writeFile(path2.join(dir, filename), content);
83
+ await fs.writeFile(path.join(dir, filename), content);
92
84
  }
93
85
  async function setupAppEntry(projectPath, navigation) {
94
86
  if (navigation === "expo-router") {
95
- const appTsxPath = path2.join(projectPath, "App.tsx");
87
+ const appTsxPath = path.join(projectPath, "App.tsx");
96
88
  if (fs.existsSync(appTsxPath)) {
97
89
  await fs.remove(appTsxPath);
98
90
  }
99
- const indexPath = path2.join(projectPath, "index.ts");
91
+ const indexPath = path.join(projectPath, "index.ts");
100
92
  if (fs.existsSync(indexPath)) {
101
93
  await fs.remove(indexPath);
102
94
  }
103
- const indexJsPath = path2.join(projectPath, "index.js");
95
+ const indexJsPath = path.join(projectPath, "index.js");
104
96
  if (fs.existsSync(indexJsPath)) {
105
97
  await fs.remove(indexJsPath);
106
98
  }
107
- const pkgPath = path2.join(projectPath, "package.json");
99
+ const pkgPath = path.join(projectPath, "package.json");
108
100
  const pkg = await fs.readJson(pkgPath);
109
101
  pkg.main = "expo-router/entry";
110
102
  await fs.writeJson(pkgPath, pkg, { spaces: 2 });
111
103
  } else {
112
- const indexPath = path2.join(projectPath, "index.ts");
104
+ const indexPath = path.join(projectPath, "index.ts");
113
105
  if (fs.existsSync(indexPath)) {
114
106
  await fs.remove(indexPath);
115
107
  }
116
- const indexJsPath = path2.join(projectPath, "index.js");
108
+ const indexJsPath = path.join(projectPath, "index.js");
117
109
  if (fs.existsSync(indexJsPath)) {
118
110
  await fs.remove(indexJsPath);
119
111
  }
@@ -122,14 +114,14 @@ async function setupAppEntry(projectPath, navigation) {
122
114
  export default function App() {
123
115
  return <Main />;
124
116
  }`;
125
- await fs.writeFile(path2.join(projectPath, "App.tsx"), appContent);
126
- const pkgPath = path2.join(projectPath, "package.json");
117
+ await fs.writeFile(path.join(projectPath, "App.tsx"), appContent);
118
+ const pkgPath = path.join(projectPath, "package.json");
127
119
  const pkg = await fs.readJson(pkgPath);
128
120
  if (pkg.main) {
129
121
  delete pkg.main;
130
122
  }
131
123
  await fs.writeJson(pkgPath, pkg, { spaces: 2 });
132
- const appJsonPath = path2.join(projectPath, "app.json");
124
+ const appJsonPath = path.join(projectPath, "app.json");
133
125
  if (fs.existsSync(appJsonPath)) {
134
126
  const appJson = await fs.readJson(appJsonPath);
135
127
  if (!appJson.expo) {
@@ -159,11 +151,11 @@ export default function Main() {
159
151
  </View>
160
152
  );
161
153
  }`;
162
- await fs.writeFile(path2.join(projectPath, "src", "Main.tsx"), mainContent);
154
+ await fs.writeFile(path.join(projectPath, "src", "Main.tsx"), mainContent);
163
155
  }
164
156
  }
165
157
  async function setupExpoRouterSrc(projectPath) {
166
- const appDir = path2.join(projectPath, "app");
158
+ const appDir = path.join(projectPath, "app");
167
159
  await fs.ensureDir(appDir);
168
160
  const layoutContent = `import React from 'react';
169
161
  import '../src/global.css';
@@ -189,7 +181,7 @@ export default function RootLayout() {
189
181
  </GestureHandlerRootView>
190
182
  );
191
183
  }`;
192
- await fs.writeFile(path2.join(appDir, "_layout.tsx"), layoutContent);
184
+ await fs.writeFile(path.join(appDir, "_layout.tsx"), layoutContent);
193
185
  const indexContent = `import React from 'react';
194
186
  import { View, Text } from 'react-native';
195
187
  import { Button } from '@/components/ui/button';
@@ -209,7 +201,7 @@ export default function IndexScreen() {
209
201
  </View>
210
202
  );
211
203
  }`;
212
- await fs.writeFile(path2.join(appDir, "index.tsx"), indexContent);
204
+ await fs.writeFile(path.join(appDir, "index.tsx"), indexContent);
213
205
  }
214
206
  async function setupReactNavigationSrc(projectPath) {
215
207
  const navContent = `import { NavigationContainer } from '@react-navigation/native';
@@ -227,7 +219,7 @@ export default function Navigation() {
227
219
  </NavigationContainer>
228
220
  );
229
221
  }`;
230
- await fs.writeFile(path2.join(projectPath, "src", "Navigation.tsx"), navContent);
222
+ await fs.writeFile(path.join(projectPath, "src", "Navigation.tsx"), navContent);
231
223
  const homeContent = `import React from 'react';
232
224
  import { View, Text } from 'react-native';
233
225
  import { Button } from '../components/ui/button';
@@ -247,7 +239,7 @@ export default function HomeScreen() {
247
239
  </View>
248
240
  );
249
241
  }`;
250
- await fs.writeFile(path2.join(projectPath, "src", "screens", "HomeScreen.tsx"), homeContent);
242
+ await fs.writeFile(path.join(projectPath, "src", "screens", "HomeScreen.tsx"), homeContent);
251
243
  const mainContent = `import React from 'react';
252
244
  import './global.css';
253
245
  import { StatusBar } from 'expo-status-bar';
@@ -261,10 +253,10 @@ export default function Main() {
261
253
  </>
262
254
  );
263
255
  }`;
264
- await fs.writeFile(path2.join(projectPath, "src", "Main.tsx"), mainContent);
256
+ await fs.writeFile(path.join(projectPath, "src", "Main.tsx"), mainContent);
265
257
  }
266
258
  async function setupAuthSrc(projectPath, navigation) {
267
- const authDir = navigation === "expo-router" ? path2.join(projectPath, "app", "(auth)") : path2.join(projectPath, "src", "screens", "auth");
259
+ const authDir = navigation === "expo-router" ? path.join(projectPath, "app", "(auth)") : path.join(projectPath, "src", "screens", "auth");
268
260
  await fs.ensureDir(authDir);
269
261
  const loginScreen = `import { View, Text } from 'react-native';
270
262
  import { Button } from '@/src/components/ui/button';
@@ -277,16 +269,16 @@ export default function LoginScreen() {
277
269
  </View>
278
270
  );
279
271
  }`;
280
- await fs.writeFile(path2.join(authDir, "login.tsx"), loginScreen);
272
+ await fs.writeFile(path.join(authDir, "login.tsx"), loginScreen);
281
273
  }
282
274
  async function setupDarkModeSrc(projectPath, navigation) {
283
275
  const themeProvider = fs.readFileSync(
284
- path2.join(SOURCE, "providers", "theme-provider.tsx")
276
+ path.join(LOCAL_SOURCE_PATH, "providers", "theme-provider.tsx")
285
277
  );
286
278
  const themeStore = fs.readFileSync(
287
- path2.join(SOURCE, "stores", "theme.ts")
279
+ path.join(LOCAL_SOURCE_PATH, "stores", "theme.ts")
288
280
  );
289
- const storesIndexPath = path2.join(projectPath, "src", "stores", "index.ts");
281
+ const storesIndexPath = path.join(projectPath, "src", "stores", "index.ts");
290
282
  let storesIndexContent = `// Auto-generated barrel export
291
283
  // This file is managed by Lunar Kit CLI
292
284
  `;
@@ -296,32 +288,32 @@ async function setupDarkModeSrc(projectPath, navigation) {
296
288
  let toolbarContent;
297
289
  if (navigation === "expo-router") {
298
290
  toolbarContent = fs.readFileSync(
299
- path2.join(SOURCE, "hooks", "useToolbar.tsx")
291
+ path.join(LOCAL_SOURCE_PATH, "hooks", "useToolbar.tsx")
300
292
  );
301
293
  } else {
302
294
  toolbarContent = fs.readFileSync(
303
- path2.join(SOURCE, "hooks", "useToolbar.react-navigation.tsx")
295
+ path.join(LOCAL_SOURCE_PATH, "hooks", "useToolbar.react-navigation.tsx")
304
296
  );
305
297
  }
306
298
  const themeContent = fs.readFileSync(
307
- path2.join(SOURCE, "hooks", "useTheme.ts")
299
+ path.join(LOCAL_SOURCE_PATH, "hooks", "useTheme.ts")
308
300
  );
309
301
  const themeColor = fs.readFileSync(
310
- path2.join(SOURCE, "hooks", "useThemeColors.ts")
302
+ path.join(LOCAL_SOURCE_PATH, "hooks", "useThemeColors.ts")
311
303
  );
312
304
  const libTheme = fs.readFileSync(
313
- path2.join(SOURCE, "lib", "theme.ts")
305
+ path.join(LOCAL_SOURCE_PATH, "lib", "theme.ts")
314
306
  );
315
- await fs.ensureDir(path2.join(projectPath, "src", "providers"));
316
- await fs.writeFile(path2.join(projectPath, "src", "providers", "theme-provider.tsx"), themeProvider);
317
- await fs.ensureDir(path2.join(projectPath, "src", "stores"));
318
- await fs.writeFile(path2.join(projectPath, "src", "stores", "theme.ts"), themeStore);
319
- await fs.ensureDir(path2.join(projectPath, "src", "hooks"));
320
- await fs.writeFile(path2.join(projectPath, "src", "hooks", "useToolbar.tsx"), toolbarContent);
321
- await fs.writeFile(path2.join(projectPath, "src", "hooks", "useTheme.ts"), themeContent);
322
- await fs.writeFile(path2.join(projectPath, "src", "hooks", "useThemeColors.ts"), themeColor);
323
- await fs.ensureDir(path2.join(projectPath, "src", "lib"));
324
- await fs.writeFile(path2.join(projectPath, "src", "lib", "theme.ts"), libTheme);
307
+ await fs.ensureDir(path.join(projectPath, "src", "providers"));
308
+ await fs.writeFile(path.join(projectPath, "src", "providers", "theme-provider.tsx"), themeProvider);
309
+ await fs.ensureDir(path.join(projectPath, "src", "stores"));
310
+ await fs.writeFile(path.join(projectPath, "src", "stores", "theme.ts"), themeStore);
311
+ await fs.ensureDir(path.join(projectPath, "src", "hooks"));
312
+ await fs.writeFile(path.join(projectPath, "src", "hooks", "useToolbar.tsx"), toolbarContent);
313
+ await fs.writeFile(path.join(projectPath, "src", "hooks", "useTheme.ts"), themeContent);
314
+ await fs.writeFile(path.join(projectPath, "src", "hooks", "useThemeColors.ts"), themeColor);
315
+ await fs.ensureDir(path.join(projectPath, "src", "lib"));
316
+ await fs.writeFile(path.join(projectPath, "src", "lib", "theme.ts"), libTheme);
325
317
  }
326
318
  async function setupFormsSrc(projectPath) {
327
319
  const hookContent = `import { useState } from 'react';
@@ -350,17 +342,17 @@ export function useForm<T>(initialValues: T) {
350
342
 
351
343
  return { values, errors, handleChange, validate };
352
344
  }`;
353
- await fs.writeFile(path2.join(projectPath, "src", "hooks", "useForm.ts"), hookContent);
345
+ await fs.writeFile(path.join(projectPath, "src", "hooks", "useForm.ts"), hookContent);
354
346
  }
355
347
  async function setupNativeWind(projectPath) {
356
348
  const globalCss = `@tailwind base;
357
349
  @tailwind components;
358
350
  @tailwind utilities;`;
359
- await fs.writeFile(path2.join(projectPath, "src", "global.css"), globalCss);
351
+ await fs.writeFile(path.join(projectPath, "src", "global.css"), globalCss);
360
352
  const tailwindConfig = fs.readFileSync(
361
- path2.join(SOURCE, "tailwind.config.js")
353
+ path.join(LOCAL_SOURCE_PATH, "tailwind.config.js")
362
354
  );
363
- await fs.writeFile(path2.join(projectPath, "tailwind.config.js"), tailwindConfig);
355
+ await fs.writeFile(path.join(projectPath, "tailwind.config.js"), tailwindConfig);
364
356
  const metroConfig = `const { getDefaultConfig } = require('expo/metro-config');
365
357
  const { withNativeWind } = require('nativewind/metro');
366
358
 
@@ -369,7 +361,7 @@ const config = getDefaultConfig(__dirname);
369
361
  module.exports = withNativeWind(config, {
370
362
  input: './src/global.css',
371
363
  });`;
372
- await fs.writeFile(path2.join(projectPath, "metro.config.js"), metroConfig);
364
+ await fs.writeFile(path.join(projectPath, "metro.config.js"), metroConfig);
373
365
  const babelConfig = `module.exports = function (api) {
374
366
  api.cache(true);
375
367
  return {
@@ -379,25 +371,25 @@ module.exports = withNativeWind(config, {
379
371
  ],
380
372
  };
381
373
  };`;
382
- await fs.writeFile(path2.join(projectPath, "babel.config.js"), babelConfig);
374
+ await fs.writeFile(path.join(projectPath, "babel.config.js"), babelConfig);
383
375
  const nativewindEnv = `/// <reference types="nativewind/types" />`;
384
- await fs.writeFile(path2.join(projectPath, "nativewind-env.d.ts"), nativewindEnv);
376
+ await fs.writeFile(path.join(projectPath, "nativewind-env.d.ts"), nativewindEnv);
385
377
  const utilsContent = fs.readFileSync(
386
- path2.join(SOURCE, "lib", "utils.ts")
378
+ path.join(LOCAL_SOURCE_PATH, "lib", "utils.ts")
387
379
  );
388
380
  const colorsContent = fs.readFileSync(
389
- path2.join(SOURCE, "lib", "theme.ts")
381
+ path.join(LOCAL_SOURCE_PATH, "lib", "theme.ts")
390
382
  );
391
- await fs.writeFile(path2.join(projectPath, "src", "lib", "utils.ts"), utilsContent);
392
- await fs.writeFile(path2.join(projectPath, "src", "lib", "theme.ts"), colorsContent);
383
+ await fs.writeFile(path.join(projectPath, "src", "lib", "utils.ts"), utilsContent);
384
+ await fs.writeFile(path.join(projectPath, "src", "lib", "theme.ts"), colorsContent);
393
385
  const buttonContent = fs.readFileSync(
394
- path2.join(COMPONENTS_SOURCE, "ui", "button.tsx")
386
+ path.join(LOCAL_COMPONENTS_PATH, "ui", "button.tsx")
395
387
  );
396
388
  const textContent = fs.readFileSync(
397
- path2.join(COMPONENTS_SOURCE, "ui", "text.tsx")
389
+ path.join(LOCAL_COMPONENTS_PATH, "ui", "text.tsx")
398
390
  );
399
- await fs.writeFile(path2.join(projectPath, "src", "components", "ui", "button.tsx"), buttonContent);
400
- await fs.writeFile(path2.join(projectPath, "src", "components", "ui", "text.tsx"), textContent);
391
+ await fs.writeFile(path.join(projectPath, "src", "components", "ui", "button.tsx"), buttonContent);
392
+ await fs.writeFile(path.join(projectPath, "src", "components", "ui", "text.tsx"), textContent);
401
393
  const tsconfigContent = `{
402
394
  "extends": "expo/tsconfig.base",
403
395
  "compilerOptions": {
@@ -413,10 +405,10 @@ module.exports = withNativeWind(config, {
413
405
  }
414
406
  }
415
407
  }`;
416
- await fs.writeFile(path2.join(projectPath, "tsconfig.json"), tsconfigContent);
408
+ await fs.writeFile(path.join(projectPath, "tsconfig.json"), tsconfigContent);
417
409
  }
418
410
  async function updatePackageJson(projectPath, navigation, features) {
419
- const pkgPath = path2.join(projectPath, "package.json");
411
+ const pkgPath = path.join(projectPath, "package.json");
420
412
  const pkg = await fs.readJson(pkgPath);
421
413
  pkg.dependencies = {
422
414
  ...pkg.dependencies,
@@ -468,7 +460,6 @@ async function createConfig(projectPath, navigation, features, packageManager) {
468
460
  storesDir: "src/stores",
469
461
  uiComponentsDir: "src/components/ui",
470
462
  packageManager,
471
- // DONE: Add this
472
463
  namingConvention: {
473
464
  files: "snake_case",
474
465
  exports: "PascalCase",
@@ -478,7 +469,7 @@ async function createConfig(projectPath, navigation, features, packageManager) {
478
469
  autoImport: true,
479
470
  autoBarrelExport: true
480
471
  };
481
- await fs.writeJson(path2.join(projectPath, "kit.config.json"), config, { spaces: 2 });
472
+ await fs.writeJson(path.join(projectPath, "kit.config.json"), config, { spaces: 2 });
482
473
  }
483
474
 
484
475
  // src/res/close.ts
@@ -505,7 +496,7 @@ function closeInitProject(packageManager, name) {
505
496
  }
506
497
 
507
498
  // src/index.ts
508
- var __filename2 = fileURLToPath2(import.meta.url);
499
+ var __filename2 = fileURLToPath(import.meta.url);
509
500
  var program = new Command();
510
501
  program.name("create-lunar-kit").description("Create a new React Native app with Lunar Kit").argument("[project-name]", "Name of your project").action(async (projectName) => {
511
502
  renderLogo();
@@ -559,7 +550,7 @@ program.name("create-lunar-kit").description("Create a new React Native app with
559
550
  console.log(chalk3.red("Project name is required"));
560
551
  process.exit(1);
561
552
  }
562
- const projectPath = path3.join(process.cwd(), name);
553
+ const projectPath = path2.join(process.cwd(), name);
563
554
  if (fs2.existsSync(projectPath)) {
564
555
  console.log(chalk3.red(`Directory ${name} already exists`));
565
556
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-lunar-kit",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Create a new React Native app with Lunar Kit and NativeWind pre-configured",
5
5
  "author": "Your Name",
6
6
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "starter"
25
25
  ],
26
26
  "dependencies": {
27
- "@lunar-kit/core": "0.1.0",
27
+ "@lunar-kit/core": "0.1.2",
28
28
  "chalk": "^5.4.1",
29
29
  "commander": "^12.1.0",
30
30
  "execa": "^9.6.1",