@lunar-kit/cli 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 (2) hide show
  1. package/README.MD +242 -0
  2. package/package.json +6 -10
package/README.MD ADDED
@@ -0,0 +1,242 @@
1
+ # @lunar-kit/cli
2
+
3
+ CLI tool for Lunar Kit - A component library for React Native with NativeWind.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @lunar-kit/cli
9
+ # or
10
+ pnpm add -g @lunar-kit/cli
11
+ # or
12
+ yarn global add @lunar-kit/cli
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ The CLI provides several commands to help you manage your Lunar Kit components:
18
+
19
+ ```bash
20
+ lunar-kit [command] [options]
21
+ # or use shorter aliases
22
+ lk [command] [options]
23
+ lunar [command] [options]
24
+ ```
25
+
26
+ ## Commands
27
+
28
+ ### `init`
29
+
30
+ Initialize Lunar Kit in your existing React Native project.
31
+
32
+ ```bash
33
+ lunar-kit init
34
+ ```
35
+
36
+ This command will:
37
+ - Create `src/components/ui` directory for your components
38
+ - Set up `lib/utils.ts` with helper functions (cn)
39
+ - Install required dependencies (clsx, tailwind-merge)
40
+ - Configure your project structure
41
+
42
+ **Options:**
43
+ - Interactive prompts will ask for:
44
+ - TypeScript preference
45
+ - Package manager (pnpm/npm/yarn)
46
+
47
+ ### `add`
48
+
49
+ Add components from the Lunar Kit registry to your project.
50
+
51
+ ```bash
52
+ lunar-kit add <component-name>
53
+ ```
54
+
55
+ **Examples:**
56
+
57
+ ```bash
58
+ # Add a single component
59
+ lunar-kit add button
60
+
61
+ # Add multiple components
62
+ lunar-kit add button card dialog
63
+
64
+ # Add all components
65
+ lunar-kit add --all
66
+ ```
67
+
68
+ **What it does:**
69
+ - Downloads component files from the registry
70
+ - Installs required dependencies
71
+ - Resolves and installs registry dependencies automatically
72
+ - Updates component imports and paths
73
+
74
+ ### `generate` (or `gen`)
75
+
76
+ Generate new components or modules using templates.
77
+
78
+ ```bash
79
+ lunar-kit generate [options]
80
+ ```
81
+
82
+ **Subcommands:**
83
+
84
+ #### Global Component
85
+ ```bash
86
+ lunar-kit gen global <component-name>
87
+ # or
88
+ lunar-kit generate global MyComponent
89
+ ```
90
+
91
+ Creates a global component in `src/components/`
92
+
93
+ #### Scoped Component
94
+ ```bash
95
+ lunar-kit gen scoped <module-name> <component-name>
96
+ # or
97
+ lunar-kit generate scoped auth LoginForm
98
+ ```
99
+
100
+ Creates a scoped component within a module, e.g., `src/modules/auth/components/LoginForm.tsx`
101
+
102
+ ### `module`
103
+
104
+ Generate a complete module structure with all necessary folders.
105
+
106
+ ```bash
107
+ lunar-kit module <module-name>
108
+ ```
109
+
110
+ **Example:**
111
+
112
+ ```bash
113
+ lunar-kit module auth
114
+ ```
115
+
116
+ This creates:
117
+ ```
118
+ src/modules/auth/
119
+ ├── components/
120
+ ├── hooks/
121
+ ├── screens/
122
+ ├── services/
123
+ └── types/
124
+ ```
125
+
126
+ ## Available Components
127
+
128
+ Lunar Kit includes a rich set of pre-built components:
129
+
130
+ - **Form Components**: Button, Input, Textarea, Checkbox, Radio, Select
131
+ - **Layout Components**: Card, Banner, Bottom Sheet, Dialog
132
+ - **Display Components**: Avatar, Badge, Text
133
+ - **Data Components**: Calendar, Date Picker, Date Range Picker
134
+ - **Navigation**: Tabs
135
+ - **Form Management**: Form (with validation)
136
+ - **Interactive**: Accordion, Select Sheet
137
+
138
+ ## Configuration
139
+
140
+ The CLI reads configuration from `kit.config.json` in your project root:
141
+
142
+ ```json
143
+ {
144
+ "typescript": true,
145
+ "componentsPath": "src/components",
146
+ "packageManager": "pnpm"
147
+ }
148
+ ```
149
+
150
+ ## Requirements
151
+
152
+ - **Node.js**: >= 18.0.0
153
+ - **React Native** project with **Expo** or bare workflow
154
+ - **NativeWind** configured in your project
155
+
156
+ ## Examples
157
+
158
+ ### Complete Setup Flow
159
+
160
+ ```bash
161
+ # 1. Create a new Expo app (if you haven't already)
162
+ npx create-expo-app my-app
163
+ cd my-app
164
+
165
+ # 2. Initialize Lunar Kit
166
+ lunar-kit init
167
+
168
+ # 3. Add some components
169
+ lunar-kit add button card input
170
+
171
+ # 4. Start building!
172
+ ```
173
+
174
+ ### Adding Components to Existing Project
175
+
176
+ ```bash
177
+ # Add specific components you need
178
+ lunar-kit add dialog select calendar
179
+
180
+ # Or add everything at once
181
+ lunar-kit add --all
182
+ ```
183
+
184
+ ### Generating Custom Components
185
+
186
+ ```bash
187
+ # Create a global shared component
188
+ lunar-kit gen global UserCard
189
+
190
+ # Create module-specific components
191
+ lunar-kit module profile
192
+ lunar-kit gen scoped profile ProfileHeader
193
+ lunar-kit gen scoped profile ProfileStats
194
+ ```
195
+
196
+ ## Package Manager Support
197
+
198
+ Lunar Kit CLI automatically detects and works with:
199
+ - **pnpm** (recommended)
200
+ - **npm**
201
+ - **yarn**
202
+
203
+ The CLI will use the package manager specified during `init` or auto-detect based on lock files.
204
+
205
+ ## Troubleshooting
206
+
207
+ ### Command not found
208
+
209
+ If you get "command not found" error after installation:
210
+
211
+ ```bash
212
+ # For npm
213
+ npm install -g @lunar-kit/cli
214
+
215
+ # For pnpm
216
+ pnpm add -g @lunar-kit/cli
217
+
218
+ # Verify installation
219
+ which lunar-kit
220
+ ```
221
+
222
+ ### Registry not found
223
+
224
+ If you encounter registry errors:
225
+
226
+ ```bash
227
+ # Reinstall the CLI
228
+ pnpm add -g @lunar-kit/cli
229
+
230
+ # Verify @lunar-kit/core is installed
231
+ pnpm list @lunar-kit/core
232
+ ```
233
+
234
+ ## Links
235
+
236
+ - [GitHub Repository](https://github.com/dimsmaul/lunar-kit)
237
+ - [Documentation](https://github.com/dimsmaul/lunar-kit#readme)
238
+ - [Report Issues](https://github.com/dimsmaul/lunar-kit/issues)
239
+
240
+ ## License
241
+
242
+ MIT © Dimas Maulana
package/package.json CHANGED
@@ -1,12 +1,8 @@
1
1
  {
2
2
  "name": "@lunar-kit/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "CLI for Lunar Kit",
5
- "bin": {
6
- "lk": "./dist/index.js",
7
- "lunar": "./dist/index.js",
8
- "lunar-kit": "./dist/index.js"
9
- },
5
+ "bin": "./dist/index.js",
10
6
  "type": "module",
11
7
  "scripts": {
12
8
  "build": "tsup",
@@ -39,16 +35,16 @@
39
35
  "expo",
40
36
  "ui-components"
41
37
  ],
42
- "author": "Your Name <your@email.com>",
38
+ "author": "Dimas Maulana",
43
39
  "license": "MIT",
44
40
  "repository": {
45
41
  "type": "git",
46
- "url": "https://github.com/yourusername/lunar-kit.git",
42
+ "url": "https://github.com/dimsmaul/lunar-kit.git",
47
43
  "directory": "packages/cli"
48
44
  },
49
- "homepage": "https://github.com/yourusername/lunar-kit#readme",
45
+ "homepage": "https://github.com/dimsmaul/lunar-kit#readme",
50
46
  "bugs": {
51
- "url": "https://github.com/yourusername/lunar-kit/issues"
47
+ "url": "https://github.com/dimsmaul/lunar-kit/issues"
52
48
  },
53
49
  "engines": {
54
50
  "node": ">=18.0.0"