9.7k

registry.json

上一页

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

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

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

定义

您可以在此处查看 registry.json 的 JSON 架构。

$schema

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

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

name

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

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

homepage

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

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

items

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

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

有关详细信息,请参阅 registry-item 架构文档