smart-registry 0.7.3 → 0.7.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 +25 -26
- package/dist/bin/index.js +1 -1
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/smart-registry)
|
|
6
6
|
[](https://github.com/nrjdalal/smart-registry)
|
|
7
7
|
|
|
8
|
-
A `zero-configuration` (no registry.json required), [shadcn add](https://ui.shadcn.com/docs/cli#add) / [open in v0](https://ui.shadcn.com/docs/registry/open-in-v0) compatible registry builder. With amazing visual feedback like how many dependencies
|
|
8
|
+
A `zero-configuration` (no registry.json required), [shadcn add](https://ui.shadcn.com/docs/cli#add) / [open in v0](https://ui.shadcn.com/docs/registry/open-in-v0) compatible registry builder. With amazing visual feedback like how many dependencies and files are being added to a file/component and much more.
|
|
9
9
|
|
|
10
|
-
> The best configuration is no configuration. Focus on developing building blocks, components, pages
|
|
10
|
+
> The best configuration is no configuration. Focus on developing building blocks, components, pages, etc rather than spending time configuring the registry.
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
@@ -38,7 +38,7 @@ Simplify your `registry.json` by removing properties like `registryDependencies`
|
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
Or delete the `registry.json` file entirely. No changes will be made to the generated `public/r/dialog.json` file. Smart right?
|
|
41
|
+
Or delete the `registry.json` file entirely. No changes will be made to the generated `public/r/dialog.json` file. Smart, right?
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
44
|
rm registry.json
|
|
@@ -88,16 +88,16 @@ Manual maintenance of `registry.json` files can lead to errors due to missing de
|
|
|
88
88
|
- [Advanced Usage](#advanced-usage)
|
|
89
89
|
- [How it Works](#how-it-works)
|
|
90
90
|
- [Extending Properties](#extending-properties)
|
|
91
|
-
- [With
|
|
92
|
-
- [Add
|
|
93
|
-
- [Additional
|
|
94
|
-
- [External
|
|
95
|
-
- [Specify
|
|
91
|
+
- [With Zero-Configuration](#with-zero-configuration)
|
|
92
|
+
- [Add Custom Properties](#add-custom-properties)
|
|
93
|
+
- [Additional Files to Include](#additional-files-to-include)
|
|
94
|
+
- [External Registry Dependencies](#external-registry-dependencies)
|
|
95
|
+
- [Specify Dependency Version](#specify-dependency-version)
|
|
96
96
|
- [Directory Structure](#directory-structure)
|
|
97
|
-
- [For `registry`
|
|
98
|
-
- [For `registry`
|
|
99
|
-
- [For `components`
|
|
100
|
-
- [For `components`
|
|
97
|
+
- [For `registry` Directory](#for-registry-directory)
|
|
98
|
+
- [For `registry` Directory with Multiple Registries](#for-registry-directory-with-multiple-registries)
|
|
99
|
+
- [For `components` Directory](#for-components-directory)
|
|
100
|
+
- [For `components` Directory with Multiple Registries](#for-components-directory-with-multiple-registries)
|
|
101
101
|
|
|
102
102
|
## Usage
|
|
103
103
|
|
|
@@ -113,7 +113,7 @@ Yeah, that's it! You don't need to do anything else. `Smart Registry` has the wo
|
|
|
113
113
|
|
|
114
114
|
### Advanced Usage
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
If you want, you can customize the output directory, working directory, and provide files or directories to build the registry from.
|
|
117
117
|
|
|
118
118
|
```plaintext
|
|
119
119
|
Version:
|
|
@@ -135,13 +135,13 @@ Author:
|
|
|
135
135
|
${author.name} <${author.email}> (${author.url})
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
-
e.g.
|
|
138
|
+
e.g. to generate the registry in the `json` directory from some file and directory at the working directory (`apps/www`).
|
|
139
139
|
|
|
140
140
|
```bash
|
|
141
141
|
npx smart-registry path/to/file.ext path/to/directory ... --output json --cwd apps/www
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
- cwd is useful when working with monorepos or multiple projects.
|
|
144
|
+
- `cwd` is useful when working with monorepos or multiple projects.
|
|
145
145
|
|
|
146
146
|
## How it Works
|
|
147
147
|
|
|
@@ -159,7 +159,7 @@ registry/
|
|
|
159
159
|
|
|
160
160
|
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).
|
|
161
161
|
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.
|
|
162
|
-
3. It will then generate a `registry.json` file by combining all the `<registry-item>.json` files
|
|
162
|
+
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`.
|
|
163
163
|
|
|
164
164
|
```plaintext
|
|
165
165
|
public/
|
|
@@ -168,7 +168,6 @@ public/
|
|
|
168
168
|
├── dialog.json
|
|
169
169
|
├── registry.json
|
|
170
170
|
└── utils.json
|
|
171
|
-
|
|
172
171
|
```
|
|
173
172
|
|
|
174
173
|
## Extending Properties
|
|
@@ -186,7 +185,7 @@ registry/
|
|
|
186
185
|
└── dialog.tsx
|
|
187
186
|
```
|
|
188
187
|
|
|
189
|
-
|
|
188
|
+
### With Zero-Configuration
|
|
190
189
|
|
|
191
190
|
<details><summary>Generated public/r/dialog.json</summary><br/>
|
|
192
191
|
|
|
@@ -215,7 +214,7 @@ registry/
|
|
|
215
214
|
|
|
216
215
|
</details>
|
|
217
216
|
|
|
218
|
-
|
|
217
|
+
### Add Custom Properties
|
|
219
218
|
|
|
220
219
|
```diff
|
|
221
220
|
{
|
|
@@ -261,7 +260,7 @@ registry/
|
|
|
261
260
|
|
|
262
261
|
</details>
|
|
263
262
|
|
|
264
|
-
|
|
263
|
+
### Additional Files to Include
|
|
265
264
|
|
|
266
265
|
```diff
|
|
267
266
|
{
|
|
@@ -313,7 +312,7 @@ registry/
|
|
|
313
312
|
|
|
314
313
|
</details>
|
|
315
314
|
|
|
316
|
-
|
|
315
|
+
### External Registry Dependencies
|
|
317
316
|
|
|
318
317
|
```diff
|
|
319
318
|
{
|
|
@@ -355,7 +354,7 @@ registry/
|
|
|
355
354
|
|
|
356
355
|
</details>
|
|
357
356
|
|
|
358
|
-
|
|
357
|
+
### Specify Dependency Version
|
|
359
358
|
|
|
360
359
|
Note: Only add the dependency that you want to specify the version for. The rest of the dependencies will be automatically added.
|
|
361
360
|
|
|
@@ -401,7 +400,7 @@ Note: Only add the dependency that you want to specify the version for. The rest
|
|
|
401
400
|
|
|
402
401
|
## Directory Structure
|
|
403
402
|
|
|
404
|
-
### For `registry`
|
|
403
|
+
### For `registry` Directory
|
|
405
404
|
|
|
406
405
|
- Use direct name for default registry.
|
|
407
406
|
|
|
@@ -448,7 +447,7 @@ public/
|
|
|
448
447
|
└── toast.json name: toast target: components/ui/toast.tsx
|
|
449
448
|
```
|
|
450
449
|
|
|
451
|
-
### For `registry`
|
|
450
|
+
### For `registry` Directory with Multiple Registries
|
|
452
451
|
|
|
453
452
|
- Use `<registry-name>` sub-directory for named registry.
|
|
454
453
|
|
|
@@ -482,7 +481,7 @@ public/
|
|
|
482
481
|
└── toast.json name: new-york/toast target: components/ui/new-york/toast.tsx
|
|
483
482
|
```
|
|
484
483
|
|
|
485
|
-
### For `components`
|
|
484
|
+
### For `components` Directory
|
|
486
485
|
|
|
487
486
|
- Use direct name for default registry.
|
|
488
487
|
|
|
@@ -512,7 +511,7 @@ public/
|
|
|
512
511
|
└── toast.json name: toast target: components/ui/toast.tsx
|
|
513
512
|
```
|
|
514
513
|
|
|
515
|
-
### For `components`
|
|
514
|
+
### For `components` Directory with Multiple Registries
|
|
516
515
|
|
|
517
516
|
- Use `<registry-name>` sub-directory for named registry.
|
|
518
517
|
|
package/dist/bin/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Q=Object.defineProperty,X=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var J=(i,t,s)=>t in i?Q(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s,u=(i,t)=>{for(var s in t||(t={}))Z.call(t,s)&&J(i,s,t[s]);if(I)for(var s of I(t))C.call(t,s)&&J(i,s,t[s]);return i},F=(i,t)=>X(i,Y(t));import _ from"node:fs";import h from"node:path";import{parseArgs as oe}from"node:util";var M=["registry/**",["blocks/**","components/**","helpers/**","hooks/**","lib/**","ui/**","utils/**"],["src/blocks/**","src/components/**","src/helpers/**","src/hooks/**","src/lib/**","src/ui/**","src/utils/**"]],j={default:["$schema","name","homepage","items"],items:{default:["$schema","name","type","description","title","author","dependencies","devDependencies","registryDependencies","files","tailwind","cssVars","meta","docs","categories"],type:{default:["registry:ui","registry:hook","registry:lib","registry:theme","registry:page","registry:file","registry:component","registry:block"]},files:{default:["type","target","content","path"],type:{default:["registry:block","registry:component","registry:file","registry:page","registry:theme","registry:lib","registry:hook","registry:ui"]}}}};import S from"node:fs";import E from"node:path";import ee from"strip-json-comments";var V=async i=>{let t={},s=["tsconfig.json","jsconfig.json"].find(n=>S.existsSync(E.resolve(i,n)));if(s){let n=await S.promises.readFile(E.resolve(i,s),"utf8"),{compilerOptions:e}=JSON.parse(ee(n,{trailingCommas:!0}));e.paths&&(t=Object.entries(e.paths).reduce((r,[o,[a]])=>(o.endsWith("*")&&a.endsWith("*")&&(r[o.replace(/\*$/,"")]=a.replace(/\*$/,"")),r),{}))}return t["@/"]||(t["@/"]=S.existsSync(E.resolve(i,"src"))?"./src/":"./"),t=Object.entries(t).sort(([n],[e])=>e.length-n.length).reduce((n,[e,r])=>(n[e]=r,n),{}),t};import B from"node:fs";import te from"node:path";var q=async i=>{let t=te.resolve(i,"registry.json"),s={$schema:"https://ui.shadcn.com/schema/registry.json",name:"nrjdalal",homepage:"https://nrjdalal.com",items:[]};return B.existsSync(t)&&(s=u({},JSON.parse(await B.promises.readFile(t,"utf8")))),s};import z from"node:fs";import T from"node:path";import{glob as se}from"tinyglobby";var v=async({cwd:i,patterns:t=["**",".**"],ignore:s=[]})=>{t=Array.isArray(t)?t:[t],t=t.map(e=>e.replace(/^'|'$/g,"").replace(/^"|"$/g,"").trim()),t=[...t,...t.flatMap(e=>e.includes("*")?[]:[e+".**",e+"**"])],t=t.filter(Boolean),s=typeof s=="string"?s.split(",").map(e=>e.trim()):s,s=s.filter(Boolean);let n=await se(t,{cwd:i,ignore:s.filter(e=>!t.includes(e))});if(!n.length)for(let e of t)try{let r=T.resolve(i,e),o=await z.promises.stat(r);if(o.isDirectory()){let a=(await z.promises.readdir(r)).map(g=>T.resolve(e,g));n.push(...a)}else o.isFile()&&n.push(e)}catch(r){continue}return n};var U=async({cwd:i,patterns:t,ignore:s})=>{let n=[];if(t.length)n=await v({cwd:i,patterns:t,ignore:s});else for(let e of M)if(n=await v({cwd:i,patterns:e,ignore:s}),n.length)break;if(!n.length)throw new Error("No files/directories found to build the registry from!");return n};import G from"node:fs";import H from"node:path";var k={imports:/import\s+type\s+[\s\S]+?from\s+['"][^'"]+['"]|import\s+['"][^'"]+['"]|import\s+[\s\S]+?from\s+['"][^'"]+['"]/g};var W=async({cwd:i,aliases:t,filepaths:s,resolved:n})=>{n=n!=null?n:new Set;let e={dependencies:[],files:[],content:{}};for(let r of s){if(n.has(r))continue;n.add(r),e.files.push(r),e.content[r]||(e.content[r]=await G.promises.readFile(H.resolve(i,r),"utf8"));let{dependencies:o,files:a,transformations:g}=await K({cwd:i,aliases:t,filepath:r,content:e.content[r]});e.content[r]=e.content[r].replace(k.imports,c=>{let y=c.match(/['"](.*)['"]/);return y&&g[y[1]]?c.replace(y[1],g[y[1]].import):c}),a.forEach(c=>e.files.push(c)),o.forEach(c=>e.dependencies.push(c))}for(let r of e.files){let{dependencies:o,files:a,content:g}=await W({cwd:i,aliases:t,filepaths:[r],resolved:n});e.content[r]||(e.content[r]=g[r]||await G.promises.readFile(H.resolve(i,r),"utf8")),a.forEach(c=>e.files.push(c)),o.forEach(c=>e.dependencies.push(c))}return e.dependencies=[...new Set(e.dependencies)].sort(),e.files=[...new Set(e.files)].sort(),e};import A from"node:path";import re from"node:path";var f=({cwd:i,aliases:t,filepath:s})=>{var r;let n=s;for(let o in t)s=s.replace(t[o].replaceAll("./","").replaceAll("../",""),"");let e=s.startsWith("registry/")?s.replace(/^registry\//,"").replace(/^(?:([^\/]*)\/)?blocks\//,(o,a)=>`blocks/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?components\/ui\//,(o,a)=>`${a?a+"/":""}ui/`).replace(/^(?:([^\/]*)\/)?components\//,(o,a)=>`components/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?hooks\//,(o,a)=>`hooks/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?lib\//,(o,a)=>`lib/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?ui\//,(o,a)=>`components/ui/${a?a+"/":""}`).replace(/\/default\//,"/").replace(/\.\.\//g,"").replace(/\.\//g,""):s.replace(/\/default\//,"/").replace(/\.\.\//g,"").replace(/\.\//g,"");return{type:e.endsWith("page.tsx")?"registry:page":((r=e.match(/^(blocks|components\/ui|components|hooks|lib|utils|helpers)/))==null?void 0:r[1].replace("blocks","registry:block").replace("components/ui","registry:ui").replace("components","registry:component").replace("hooks","registry:hook").replace("lib","registry:lib").replace("utils","registry:lib").replace("helpers","registry:lib"))||"registry:file",name:e.replace(/^(blocks|components\/ui|components|hooks|lib|utils|helpers)\//,"").replace(/\.[^\/.]+$/,"").replace(/\/index$/,"").replace(/\/route$/,"").replace(/\/\[.*\]$/,""),import:"@/"+e.replace(i+re.sep,"").replace(/\.[^/.]+$/,"").replace(/\/index$/,""),target:n.split("/").length>1?e:`~/${e}`,path:s}};var ie=async({cwd:i,current:t,aliases:s})=>{t=t.replace(new RegExp(`^${Object.keys(s).find(e=>t.startsWith(e.replace(/\.\//g,"").replace(/\.\.\//g,"")))}`),s[Object.keys(s).find(e=>t.startsWith(e.replace(/\.\//g,"").replace(/\.\.\//g,"")))]),t=t.replace(/\.\//g,"").replace(/\.\.\//g,"");let n=await v({cwd:i,patterns:t});return t=n.find(e=>e.startsWith(t+"."))||n.find(e=>e.startsWith(t+"/index"))||t,t.replace(i+"/","")},ne=async({cwd:i,filepath:t,current:s})=>{s=A.relative(i,A.resolve(i,A.dirname(t),s));let n=await v({cwd:i,patterns:s});return s=n.find(e=>e.startsWith(s+"."))||n.find(e=>e.startsWith(s+"/index"))||s,s.replace(i+"/","")},K=async({cwd:i,aliases:t,filepath:s,content:n})=>{let e={dependencies:[],files:[],transformations:{}},r=n.match(k.imports)||[];if(!r.length)return e;r=r.map(o=>{var a;return(a=o.match(/['"](.*)['"]/))==null?void 0:a[1].replace(/\/\//g,"/")});for(let o of r){let a=o;Object.keys(t).some(c=>o.startsWith(c.replace(/\.\//g,"").replace(/\.\.\//g,"")))?(o=await ie({cwd:i,aliases:t,current:o}),e.transformations[a]=f({cwd:i,aliases:t,filepath:o}),e.files.push(o)):o.startsWith(".")?(o=await ne({cwd:i,filepath:s,current:o}),e.transformations[a]=f({cwd:i,aliases:t,filepath:o}),e.files.push(o)):o.startsWith("@")?e.dependencies.push(o.split("/").slice(0,2).join("/")):e.dependencies.push(o.replace(/\/.*/,""))}return e};var R="smart-registry",P="0.7.
|
|
2
|
+
var Q=Object.defineProperty,X=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var I=Object.getOwnPropertySymbols;var Z=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var J=(i,t,s)=>t in i?Q(i,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[t]=s,u=(i,t)=>{for(var s in t||(t={}))Z.call(t,s)&&J(i,s,t[s]);if(I)for(var s of I(t))C.call(t,s)&&J(i,s,t[s]);return i},F=(i,t)=>X(i,Y(t));import _ from"node:fs";import h from"node:path";import{parseArgs as oe}from"node:util";var M=["registry/**",["blocks/**","components/**","helpers/**","hooks/**","lib/**","ui/**","utils/**"],["src/blocks/**","src/components/**","src/helpers/**","src/hooks/**","src/lib/**","src/ui/**","src/utils/**"]],j={default:["$schema","name","homepage","items"],items:{default:["$schema","name","type","description","title","author","dependencies","devDependencies","registryDependencies","files","tailwind","cssVars","meta","docs","categories"],type:{default:["registry:ui","registry:hook","registry:lib","registry:theme","registry:page","registry:file","registry:component","registry:block"]},files:{default:["type","target","content","path"],type:{default:["registry:block","registry:component","registry:file","registry:page","registry:theme","registry:lib","registry:hook","registry:ui"]}}}};import S from"node:fs";import E from"node:path";import ee from"strip-json-comments";var V=async i=>{let t={},s=["tsconfig.json","jsconfig.json"].find(n=>S.existsSync(E.resolve(i,n)));if(s){let n=await S.promises.readFile(E.resolve(i,s),"utf8"),{compilerOptions:e}=JSON.parse(ee(n,{trailingCommas:!0}));e.paths&&(t=Object.entries(e.paths).reduce((r,[o,[a]])=>(o.endsWith("*")&&a.endsWith("*")&&(r[o.replace(/\*$/,"")]=a.replace(/\*$/,"")),r),{}))}return t["@/"]||(t["@/"]=S.existsSync(E.resolve(i,"src"))?"./src/":"./"),t=Object.entries(t).sort(([n],[e])=>e.length-n.length).reduce((n,[e,r])=>(n[e]=r,n),{}),t};import B from"node:fs";import te from"node:path";var q=async i=>{let t=te.resolve(i,"registry.json"),s={$schema:"https://ui.shadcn.com/schema/registry.json",name:"nrjdalal",homepage:"https://nrjdalal.com",items:[]};return B.existsSync(t)&&(s=u({},JSON.parse(await B.promises.readFile(t,"utf8")))),s};import z from"node:fs";import T from"node:path";import{glob as se}from"tinyglobby";var v=async({cwd:i,patterns:t=["**",".**"],ignore:s=[]})=>{t=Array.isArray(t)?t:[t],t=t.map(e=>e.replace(/^'|'$/g,"").replace(/^"|"$/g,"").trim()),t=[...t,...t.flatMap(e=>e.includes("*")?[]:[e+".**",e+"**"])],t=t.filter(Boolean),s=typeof s=="string"?s.split(",").map(e=>e.trim()):s,s=s.filter(Boolean);let n=await se(t,{cwd:i,ignore:s.filter(e=>!t.includes(e))});if(!n.length)for(let e of t)try{let r=T.resolve(i,e),o=await z.promises.stat(r);if(o.isDirectory()){let a=(await z.promises.readdir(r)).map(g=>T.resolve(e,g));n.push(...a)}else o.isFile()&&n.push(e)}catch(r){continue}return n};var U=async({cwd:i,patterns:t,ignore:s})=>{let n=[];if(t.length)n=await v({cwd:i,patterns:t,ignore:s});else for(let e of M)if(n=await v({cwd:i,patterns:e,ignore:s}),n.length)break;if(!n.length)throw new Error("No files/directories found to build the registry from!");return n};import G from"node:fs";import H from"node:path";var k={imports:/import\s+type\s+[\s\S]+?from\s+['"][^'"]+['"]|import\s+['"][^'"]+['"]|import\s+[\s\S]+?from\s+['"][^'"]+['"]/g};var W=async({cwd:i,aliases:t,filepaths:s,resolved:n})=>{n=n!=null?n:new Set;let e={dependencies:[],files:[],content:{}};for(let r of s){if(n.has(r))continue;n.add(r),e.files.push(r),e.content[r]||(e.content[r]=await G.promises.readFile(H.resolve(i,r),"utf8"));let{dependencies:o,files:a,transformations:g}=await K({cwd:i,aliases:t,filepath:r,content:e.content[r]});e.content[r]=e.content[r].replace(k.imports,c=>{let y=c.match(/['"](.*)['"]/);return y&&g[y[1]]?c.replace(y[1],g[y[1]].import):c}),a.forEach(c=>e.files.push(c)),o.forEach(c=>e.dependencies.push(c))}for(let r of e.files){let{dependencies:o,files:a,content:g}=await W({cwd:i,aliases:t,filepaths:[r],resolved:n});e.content[r]||(e.content[r]=g[r]||await G.promises.readFile(H.resolve(i,r),"utf8")),a.forEach(c=>e.files.push(c)),o.forEach(c=>e.dependencies.push(c))}return e.dependencies=[...new Set(e.dependencies)].sort(),e.files=[...new Set(e.files)].sort(),e};import A from"node:path";import re from"node:path";var f=({cwd:i,aliases:t,filepath:s})=>{var r;let n=s;for(let o in t)s=s.replace(t[o].replaceAll("./","").replaceAll("../",""),"");let e=s.startsWith("registry/")?s.replace(/^registry\//,"").replace(/^(?:([^\/]*)\/)?blocks\//,(o,a)=>`blocks/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?components\/ui\//,(o,a)=>`${a?a+"/":""}ui/`).replace(/^(?:([^\/]*)\/)?components\//,(o,a)=>`components/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?hooks\//,(o,a)=>`hooks/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?lib\//,(o,a)=>`lib/${a?a+"/":""}`).replace(/^(?:([^\/]*)\/)?ui\//,(o,a)=>`components/ui/${a?a+"/":""}`).replace(/\/default\//,"/").replace(/\.\.\//g,"").replace(/\.\//g,""):s.replace(/\/default\//,"/").replace(/\.\.\//g,"").replace(/\.\//g,"");return{type:e.endsWith("page.tsx")?"registry:page":((r=e.match(/^(blocks|components\/ui|components|hooks|lib|utils|helpers)/))==null?void 0:r[1].replace("blocks","registry:block").replace("components/ui","registry:ui").replace("components","registry:component").replace("hooks","registry:hook").replace("lib","registry:lib").replace("utils","registry:lib").replace("helpers","registry:lib"))||"registry:file",name:e.replace(/^(blocks|components\/ui|components|hooks|lib|utils|helpers)\//,"").replace(/\.[^\/.]+$/,"").replace(/\/index$/,"").replace(/\/route$/,"").replace(/\/\[.*\]$/,""),import:"@/"+e.replace(i+re.sep,"").replace(/\.[^/.]+$/,"").replace(/\/index$/,""),target:n.split("/").length>1?e:`~/${e}`,path:s}};var ie=async({cwd:i,current:t,aliases:s})=>{t=t.replace(new RegExp(`^${Object.keys(s).find(e=>t.startsWith(e.replace(/\.\//g,"").replace(/\.\.\//g,"")))}`),s[Object.keys(s).find(e=>t.startsWith(e.replace(/\.\//g,"").replace(/\.\.\//g,"")))]),t=t.replace(/\.\//g,"").replace(/\.\.\//g,"");let n=await v({cwd:i,patterns:t});return t=n.find(e=>e.startsWith(t+"."))||n.find(e=>e.startsWith(t+"/index"))||t,t.replace(i+"/","")},ne=async({cwd:i,filepath:t,current:s})=>{s=A.relative(i,A.resolve(i,A.dirname(t),s));let n=await v({cwd:i,patterns:s});return s=n.find(e=>e.startsWith(s+"."))||n.find(e=>e.startsWith(s+"/index"))||s,s.replace(i+"/","")},K=async({cwd:i,aliases:t,filepath:s,content:n})=>{let e={dependencies:[],files:[],transformations:{}},r=n.match(k.imports)||[];if(!r.length)return e;r=r.map(o=>{var a;return(a=o.match(/['"](.*)['"]/))==null?void 0:a[1].replace(/\/\//g,"/")});for(let o of r){let a=o;Object.keys(t).some(c=>o.startsWith(c.replace(/\.\//g,"").replace(/\.\.\//g,"")))?(o=await ie({cwd:i,aliases:t,current:o}),e.transformations[a]=f({cwd:i,aliases:t,filepath:o}),e.files.push(o)):o.startsWith(".")?(o=await ne({cwd:i,filepath:s,current:o}),e.transformations[a]=f({cwd:i,aliases:t,filepath:o}),e.files.push(o)):o.startsWith("@")?e.dependencies.push(o.split("/").slice(0,2).join("/")):e.dependencies.push(o.replace(/\/.*/,""))}return e};var R="smart-registry",P="0.7.4";var O={name:"Neeraj Dalal",email:"admin@nrjdalal.com",url:"https://nrjdalal.com"};var L=`Version:
|
|
3
3
|
${R}@${P}
|
|
4
4
|
|
|
5
5
|
Usage:
|
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smart-registry",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"description": "A zero-configuration (no registry.json required), shadcn add / open in v0 compatible registry builder.",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
6
|
+
"components",
|
|
7
|
+
"ui",
|
|
8
|
+
"tailwind",
|
|
9
|
+
"radix-ui",
|
|
10
|
+
"shadcn",
|
|
11
|
+
"react",
|
|
12
|
+
"nextjs",
|
|
13
|
+
"v0"
|
|
7
14
|
],
|
|
8
15
|
"homepage": "https://github.com/nrjdalal/smart-registry#readme",
|
|
9
16
|
"bugs": "https://github.com/nrjdalal/smart-registry/issues",
|