@lunar-kit/cli 0.1.0 → 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 +242 -0
- package/package.json +2 -2
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunar-kit/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI for Lunar Kit",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lk": "./dist/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"prepublishOnly": "pnpm build"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lunar-kit/core": "
|
|
17
|
+
"@lunar-kit/core": "0.1.0",
|
|
18
18
|
"axios": "^1.13.2",
|
|
19
19
|
"chalk": "^5.6.2",
|
|
20
20
|
"commander": "^14.0.2",
|