Skip to content

Commit 5fc5bb1

Browse files
docs: enhance README with detailed usage instructions and examples for npx and global installation
1 parent d19abd1 commit 5fc5bb1

File tree

1 file changed

+150
-9
lines changed

1 file changed

+150
-9
lines changed

README.md

Lines changed: 150 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,76 @@
77

88
🚀 A powerful CLI tool to automatically generate shadcn/ui registry JSON files for your projects with intelligent component detection and clean, maintainable architecture.
99

10+
## 🔥 Multiple Ways to Use
11+
12+
### 1. **npx** (Recommended - Always Latest)
13+
14+
```bash
15+
npx shadiff@latest generate
16+
```
17+
18+
### 2. **Global Installation**
19+
20+
```bash
21+
npm install -g shadiff
22+
shadiff generate
23+
```
24+
25+
### 3. **Local Dev Dependency**
26+
27+
```bash
28+
npm install --save-dev shadiff
29+
npx shadiff generate
30+
```
31+
32+
### 4. **Package Scripts**
33+
34+
Add to your `package.json`:
35+
36+
```json
37+
{
38+
"scripts": {
39+
"generate-registry": "shadiff generate",
40+
"init-registry": "shadiff init"
41+
}
42+
}
43+
```
44+
45+
Then run: `npm run generate-registry`
46+
1047
## 🚀 Quick Start
1148

49+
### Using npx (No Installation Required)
50+
51+
```bash
52+
# Generate registry instantly with the latest version
53+
npx shadiff@latest generate
54+
55+
# Initialize config with latest version
56+
npx shadiff@latest init
57+
58+
# Generate with custom options
59+
npx shadiff@latest generate --root-dir ./src --output my-registry.json --author "Your Name"
60+
```
61+
62+
### Global Installation
63+
1264
```bash
1365
# Install globally
1466
npm install -g shadiff
67+
```
68+
69+
```bash
70+
# or
71+
yarn global add shadiff
72+
```
1573

74+
```bash
75+
# or
76+
pnpm add -g shadiff
77+
```
78+
79+
```bash
1680
# Generate registry for your project
1781
cd your-project
1882
shadiff generate
@@ -49,7 +113,17 @@ For detailed architecture documentation, see [ARCHITECTURE.md](./ARCHITECTURE.md
49113

50114
## 📋 Installation
51115

52-
### Global Installation (Recommended)
116+
### Using npx (Recommended - No Installation Required)
117+
118+
The easiest way to use shadiff is with npx, which always uses the latest version:
119+
120+
```bash
121+
npx shadiff@latest generate
122+
```
123+
124+
This approach ensures you're always using the latest features and bug fixes without needing to manage package versions.
125+
126+
### Global Installation
53127

54128
```bash
55129
npm install -g shadiff
@@ -76,6 +150,10 @@ pnpm add --save-dev shadiff
76150
Navigate to your project root and run:
77151

78152
```bash
153+
# Using npx (recommended)
154+
npx shadiff@latest generate
155+
156+
# Or if globally installed
79157
shadiff generate
80158
```
81159

@@ -86,16 +164,26 @@ This will generate a `registry.json` file with all your project components.
86164
#### Generate Registry
87165

88166
```bash
89-
# Generate with default settings
167+
# Using npx (latest version)
168+
npx shadiff@latest generate
169+
170+
# Generate with default settings (global install)
90171
shadiff generate
91172

92-
# Custom options
173+
# Custom options with npx
174+
npx shadiff@latest generate --root-dir ./src --output my-registry.json --author "Your Name"
175+
176+
# Custom options (global install)
93177
shadiff generate --root-dir ./src --output my-registry.json --author "Your Name"
94178
```
95179

96180
#### Initialize Configuration
97181

98182
```bash
183+
# Using npx
184+
npx shadiff@latest init
185+
186+
# Global install
99187
shadiff init
100188
```
101189

@@ -161,7 +249,7 @@ The CLI automatically detects these shadcn/ui components:
161249
- `navigation-menu`, `pagination`, `popover`, `progress`, `radio-group`
162250
- `resizable`, `scroll-area`, `select`, `separator`, `sheet`, `sidebar`
163251
- `skeleton`, `slider`, `sonner`, `switch`, `table`, `tabs`, `textarea`
164-
- `toast`, `toggle`, `toggle-group`, `tooltip`
252+
- `toggle`, `toggle-group`, `tooltip`
165253

166254
## Smart Dependency Filtering
167255

@@ -185,6 +273,10 @@ The CLI automatically excludes common framework packages to keep your registry c
185273
Quickly generate a registry when moving components between projects:
186274

187275
```bash
276+
# Using npx
277+
npx shadiff@latest generate --output migration-registry.json
278+
279+
# Or with global install
188280
cd my-shadcn-project
189281
shadiff generate --output migration-registry.json
190282
```
@@ -194,6 +286,10 @@ shadiff generate --output migration-registry.json
194286
Share your component library with team members:
195287

196288
```bash
289+
# Using npx
290+
npx shadiff@latest generate --author "Design System Team"
291+
292+
# Or with global install
197293
shadiff generate --author "Design System Team"
198294
```
199295

@@ -202,18 +298,63 @@ shadiff generate --author "Design System Team"
202298
Create registries for publishing component libraries:
203299

204300
```bash
301+
# Using npx
302+
npx shadiff@latest generate --output dist/registry.json
303+
304+
# Or with global install
205305
shadiff generate --output dist/registry.json
206306
```
207307

208308
## API Reference
209309

310+
### All Available Commands
311+
312+
```bash
313+
# Generate registry (main command)
314+
npx shadiff@latest generate [options]
315+
shadiff generate [options]
316+
317+
# Initialize configuration file
318+
npx shadiff@latest init
319+
shadiff init
320+
321+
# Show help
322+
npx shadiff@latest --help
323+
shadiff --help
324+
325+
# Show version
326+
npx shadiff@latest --version
327+
shadiff --version
328+
```
329+
210330
### CLI Options
211331

212-
| Option | Description | Default |
213-
|--------|-------------|---------|
214-
| `--root-dir, -r` | Root directory to scan | `process.cwd()` |
215-
| `--output, -o` | Output file path | `registry.json` |
216-
| `--author, -a` | Author information | `Project Author` |
332+
| Option | Alias | Description | Default | Example |
333+
|--------|-------|-------------|---------|---------|
334+
| `--root-dir` | `-r` | Root directory to scan | `process.cwd()` | `--root-dir ./src` |
335+
| `--output` | `-o` | Output file path | `registry.json` | `--output my-registry.json` |
336+
| `--author` | `-a` | Author information | `Project Author` | `--author "John Doe"` |
337+
| `--help` | `-h` | Show help information | - | `--help` |
338+
| `--version` | `-v` | Show version | - | `--version` |
339+
340+
### Command Examples
341+
342+
```bash
343+
# Basic usage
344+
npx shadiff@latest generate
345+
346+
# Custom output file
347+
npx shadiff@latest generate --output components-registry.json
348+
349+
# Scan specific directory
350+
npx shadiff@latest generate --root-dir ./src/components
351+
352+
# Set author information
353+
npx shadiff@latest generate --author "Design Team <design@company.com>"
354+
355+
# Combine multiple options
356+
npx shadiff@latest generate --root-dir ./src --output ./dist/registry.json --author "Your Name"
357+
```
217358

218359
### File Categories
219360

0 commit comments

Comments
 (0)