Skip to content

Commit 5466432

Browse files
committed
docs(www): update registry
1 parent 2f6c3e7 commit 5466432

File tree

4 files changed

+25
-22
lines changed

4 files changed

+25
-22
lines changed

apps/www/content/docs/registry/faq.mdx

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ Here's an example of a complex component that installs a page, two components, a
1818
"description": "A complex hello world component",
1919
"files": [
2020
{
21-
"path": "registry/hello-world/page.tsx",
21+
"path": "registry/new-york/hello-world/page.tsx",
2222
"type": "registry:page",
2323
"target": "app/hello/page.tsx"
2424
},
2525
{
26-
"path": "registry/hello-world/components/hello-world.tsx",
26+
"path": "registry/new-york/hello-world/components/hello-world.tsx",
2727
"type": "registry:component"
2828
},
2929
{
30-
"path": "registry/hello-world/components/formatted-message.tsx",
30+
"path": "registry/new-york/hello-world/components/formatted-message.tsx",
3131
"type": "registry:component"
3232
},
3333
{
34-
"path": "registry/hello-world/hooks/use-hello.ts",
34+
"path": "registry/new-york/hello-world/hooks/use-hello.ts",
3535
"type": "registry:hook"
3636
},
3737
{
38-
"path": "registry/hello-world/lib/format-date.ts",
38+
"path": "registry/new-york/hello-world/lib/format-date.ts",
3939
"type": "registry:utils"
4040
},
4141
{
42-
"path": "registry/hello-world/hello.config.ts",
42+
"path": "registry/new-york/hello-world/hello.config.ts",
4343
"type": "registry:file",
4444
"target": "~/hello.config.ts"
4545
}

apps/www/content/docs/registry/getting-started.mdx

+11-8
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This `registry.json` file must conform to the [registry schema specification](/d
4444

4545
Add your first component. Here's an example of a simple `<HelloWorld />` component:
4646

47-
```tsx title="registry/hello-world/hello-world.tsx" showLineNumbers
47+
```tsx title="registry/new-york/hello-world/hello-world.tsx" showLineNumbers
4848
import { Button } from "@/components/ui/button"
4949

5050
export function HelloWorld() {
@@ -53,15 +53,17 @@ export function HelloWorld() {
5353
```
5454

5555
<Callout className="mt-6">
56-
**Note:** This example places the component in the `registry` directory. You
57-
can place it anywhere in your project as long as you set the correct path in
58-
the `registry.json` file.
56+
**Note:** This example places the component in the `registry/new-york`
57+
directory. You can place it anywhere in your project as long as you set the
58+
correct path in the `registry.json` file and you follow the `registry/[NAME]`
59+
directory structure.
5960
</Callout>
6061

6162
```txt
6263
registry
63-
└── hello-world
64-
└── hello-world.tsx
64+
└── new-york
65+
└── hello-world
66+
└── hello-world.tsx
6567
```
6668

6769
<Callout className="mt-6 [&_[data-rehype-pretty-code-title]]:pt-1 [&_pre]:mb-0">
@@ -94,7 +96,7 @@ To add your component to the registry, you need to add your component definition
9496
"description": "A simple hello world component.",
9597
"files": [
9698
{
97-
"path": "registry/hello-world/hello-world.tsx",
99+
"path": "registry/new-york/hello-world/hello-world.tsx",
98100
"type": "registry:component"
99101
}
100102
]
@@ -171,10 +173,11 @@ To make your registry available to other developers, you can publish it by deplo
171173

172174
Here are some guidelines to follow when building components for a registry.
173175

176+
- Place your registry item in the `registry/[STYLE]/[NAME]` directory. I'm using `new-york` as an example. It can be anything you want as long as it's nested under the `registry` directory.
174177
- The following properties are required for the block definition: `name`, `description`, `type` and `files`.
175178
- Make sure to list all registry dependencies in `registryDependencies`. A registry dependency is the name of the component in the registry eg. `input`, `button`, `card`, etc or a URL to a registry item eg. `http://localhost:3000/r/editor.json`.
176179
- Make sure to list all dependencies in `dependencies`. A dependency is the name of the package in the registry eg. `zod`, `sonner`, etc. To set a version, you can use the `name@version` format eg. `zod@^3.20.0`.
177-
- **Imports should always use the `@/registry` path.** eg. `import { HelloWorld } from "@/registry/hello-world/hello-world"`
180+
- **Imports should always use the `@/registry` path.** eg. `import { HelloWorld } from "@/registry/new-york/hello-world/hello-world"`
178181
- Ideally, place your files within a registry item in `components`, `hooks`, `lib` directories.
179182

180183
## Install using the CLI

apps/www/content/docs/registry/registry-item-json.mdx

+6-6
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ The `registry-item.json` schema is used to define your custom registry items.
1414
"description": "A simple hello world component.",
1515
"files": [
1616
{
17-
"path": "registry/hello-world/hello-world.tsx",
17+
"path": "registry/new-york/hello-world/hello-world.tsx",
1818
"type": "registry:component"
1919
},
2020
{
21-
"path": "registry/hello-world/use-hello-world.ts",
21+
"path": "registry/new-york/hello-world/use-hello-world.ts",
2222
"type": "registry:hook"
2323
}
2424
]
@@ -150,20 +150,20 @@ The `files` property is used to specify the files of your registry item. Each fi
150150
{
151151
"files": [
152152
{
153-
"path": "registry/hello-world/page.tsx",
153+
"path": "registry/new-york/hello-world/page.tsx",
154154
"type": "registry:page",
155155
"target": "app/hello/page.tsx"
156156
},
157157
{
158-
"path": "registry/hello-world/hello-world.tsx",
158+
"path": "registry/new-york/hello-world/hello-world.tsx",
159159
"type": "registry:component"
160160
},
161161
{
162-
"path": "registry/hello-world/use-hello-world.ts",
162+
"path": "registry/new-york/hello-world/use-hello-world.ts",
163163
"type": "registry:hook"
164164
},
165165
{
166-
"path": "registry/hello-world/.env",
166+
"path": "registry/new-york/hello-world/.env",
167167
"type": "registry:file",
168168
"target": "~/.env"
169169
}

apps/www/content/docs/registry/registry-json.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The `registry.json` schema is used to define your custom component registry.
1818
"description": "A simple hello world component.",
1919
"files": [
2020
{
21-
"path": "registry/hello-world/hello-world.tsx",
21+
"path": "registry/new-york/hello-world/hello-world.tsx",
2222
"type": "registry:component"
2323
}
2424
]
@@ -75,7 +75,7 @@ The `items` in your registry. Each item must implement the [registry-item schema
7575
"description": "A simple hello world component.",
7676
"files": [
7777
{
78-
"path": "registry/hello-world/hello-world.tsx",
78+
"path": "registry/new-york/hello-world/hello-world.tsx",
7979
"type": "registry:component"
8080
}
8181
]

0 commit comments

Comments
 (0)