Docs
registry.json

registry.json

用于运行你自己的组件注册表的架构。

registry.json 架构用于定义自定义组件注册表。

¥The registry.json schema is used to define your custom component registry.

registry.json
{
  "$schema": "https://shadcn.nodejs.cn/schema/registry.json",
  "name": "shadcn",
  "homepage": "https://shadcn.nodejs.cn",
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "A simple hello world component.",
      "files": [
        {
          "path": "registry/hello-world/hello-world.tsx",
          "type": "registry:component"
        }
      ]
    }
  ]
}

定义

¥Definitions

你可以查看 registry.json 此处 的 JSON 模式。

¥You can see the JSON Schema for registry.json here.

$schema

$schema 属性用于指定 registry.json 文件的架构。

¥The $schema property is used to specify the schema for the registry.json file.

registry.json
{
  "$schema": "https://shadcn.nodejs.cn/schema/registry.json"
}

name

name 属性用于指定注册表的名称。这用于数据属性和其他元数据。

¥The name property is used to specify the name of your registry. This is used for data attributes and other metadata.

registry.json
{
  "name": "acme"
}

homepage

你的注册表的主页。这用于数据属性和其他元数据。

¥The homepage of your registry. This is used for data attributes and other metadata.

registry.json
{
  "homepage": "https://acme.com"
}

items

注册表中的 items。每个项目都必须实现 注册表项架构规范

¥The items in your registry. Each item must implement the registry-item schema specification.

registry.json
{
  "items": [
    {
      "name": "hello-world",
      "type": "registry:block",
      "title": "Hello World",
      "description": "A simple hello world component.",
      "files": [
        {
          "path": "registry/hello-world/hello-world.tsx",
          "type": "registry:component"
        }
      ]
    }
  ]
}

有关更多信息,请参阅 注册表项架构文档

¥See the registry-item schema documentation for more information.