smart-registry 0.6.3 → 0.6.5
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 +42 -28
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,7 +71,7 @@ Simplify your `registry.json` by removing properties like `registryDependencies`
|
|
|
71
71
|
|
|
72
72
|
<br/>
|
|
73
73
|
|
|
74
|
-
Manual maintenance of `registry.json` files can lead to errors due to missing dependencies or files, or wrongful addition of unnecessary ones. `Smart Registry` reduces these risks by automating the detection and generation of the
|
|
74
|
+
Manual maintenance of `registry.json` files can lead to errors due to missing dependencies or files, or wrongful addition of unnecessary ones. `Smart Registry` reduces these risks by automating the detection and generation of the all-in-one `r/registry.json` and `r/<registry-item>.json` entries, making registry management more efficient.
|
|
75
75
|
|
|
76
76
|
## Table of Contents
|
|
77
77
|
|
|
@@ -99,22 +99,32 @@ If your project contains a `registry`, `components`, or `src/components` directo
|
|
|
99
99
|
npx smart-registry
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
```plaintext
|
|
103
|
+
Version:
|
|
104
|
+
${name}@${version}
|
|
103
105
|
|
|
104
|
-
|
|
106
|
+
Usage:
|
|
107
|
+
$ ${name} [options] [files/directories] ...
|
|
105
108
|
|
|
106
|
-
|
|
109
|
+
Arguments:
|
|
110
|
+
files/directories files or directories to build the registry from (optional)
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
Options:
|
|
113
|
+
-o, --output <path> destination directory for json files (default: "./public/r")
|
|
114
|
+
-c, --cwd <cwd> the working directory (default: "./")
|
|
115
|
+
-v, --version display version
|
|
116
|
+
-h, --help display help
|
|
117
|
+
|
|
118
|
+
Author:
|
|
119
|
+
${author.name} <${author.email}> (${author.url})
|
|
110
120
|
```
|
|
111
121
|
|
|
112
|
-
### From Specific Directories
|
|
122
|
+
### From Specific Files or Directories
|
|
113
123
|
|
|
114
|
-
|
|
124
|
+
If you want to generate the registry from specific files or directories, you can pass them as arguments.
|
|
115
125
|
|
|
116
126
|
```bash
|
|
117
|
-
npx smart-registry
|
|
127
|
+
npx smart-registry path/to/file.ts path/to/directory ...
|
|
118
128
|
```
|
|
119
129
|
|
|
120
130
|
## How it Works
|
|
@@ -131,17 +141,18 @@ registry/
|
|
|
131
141
|
└── dialog.tsx
|
|
132
142
|
```
|
|
133
143
|
|
|
134
|
-
1. `Smart Registry` will scan the `registry` directory
|
|
144
|
+
1. `Smart Registry` will scan the `registry` directory and its sub-directories to find all the files (if no `registry` directory is found, it will scan the `components` or `src/components` directory).
|
|
135
145
|
2. For each file, it will generate a `<registry-item>.json` file by reading the file's content and extracting the imports for registry dependencies, dependencies, and files recursively.
|
|
136
|
-
3. It will then generate a `registry.json` file by combining all the `<registry-item>.json` files with all the properties required for `shadcn add` or `open in v0`.
|
|
146
|
+
3. It will then generate a `registry.json` file by combining all the `<registry-item>.json` files and `<registry-item>.json` files with all the properties required for `shadcn add` or `open in v0`.
|
|
137
147
|
|
|
138
148
|
```plaintext
|
|
139
149
|
public/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
└──
|
|
150
|
+
└── r/
|
|
151
|
+
├── button.json
|
|
152
|
+
├── dialog.json
|
|
153
|
+
├── registry.json
|
|
154
|
+
└── utils.json
|
|
155
|
+
|
|
145
156
|
```
|
|
146
157
|
|
|
147
158
|
## Extending Properties
|
|
@@ -446,12 +457,13 @@ Generates the following items in `public/r` directory.
|
|
|
446
457
|
```plaintext
|
|
447
458
|
public/
|
|
448
459
|
└── r/
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
460
|
+
├── registry.json
|
|
461
|
+
└── new-york/
|
|
462
|
+
├── toasty.json name: new-york/toasty target: blocks/new-york/toasty.tsx
|
|
463
|
+
├── toaster.json name: new-york/toaster target: components/new-york/toaster.tsx
|
|
464
|
+
├── use-toast.json name: new-york/use-toast target: hooks/new-york/use-toast.ts
|
|
465
|
+
├── utils.json name: new-york/utils target: lib/new-york/utils.ts
|
|
466
|
+
└── toast.json name: new-york/toast target: components/ui/new-york/toast.tsx
|
|
455
467
|
```
|
|
456
468
|
|
|
457
469
|
### For `components` directory.
|
|
@@ -476,6 +488,7 @@ Generates the following items in `public/r` directory.
|
|
|
476
488
|
```plaintext
|
|
477
489
|
public/
|
|
478
490
|
└── r/
|
|
491
|
+
├── registry.json
|
|
479
492
|
├── toasty.json name: toasty target: blocks/toasty.tsx
|
|
480
493
|
├── component.json name: toaster target: components/toaster.tsx
|
|
481
494
|
├── use-toast.json name: use-toast target: hooks/use-toast.ts
|
|
@@ -510,10 +523,11 @@ Generates the following items in `public/r` directory.
|
|
|
510
523
|
```plaintext
|
|
511
524
|
public/
|
|
512
525
|
└── r/
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
526
|
+
├── registry.json
|
|
527
|
+
└── new-york/
|
|
528
|
+
├── toasty.json name: new-york/toasty target: blocks/new-york/toasty.tsx
|
|
529
|
+
├── toaster.json name: new-york/toaster target: components/new-york/toaster.tsx
|
|
530
|
+
├── use-toast.json name: new-york/use-toast target: hooks/new-york/use-toast.ts
|
|
531
|
+
├── utils.json name: new-york/utils target: lib/new-york/utils.ts
|
|
532
|
+
└── toast.json name: new-york/toast target: components/ui/new-york/toast.tsx
|
|
519
533
|
```
|