组件
开源注册表索引是所有可开箱即用的开源注册表的列表。
🌐 The open source registry index is a list of all the open source registries that are available to use out of the box.
当你运行 shadcn add 或 shadcn search 时,CLI 会自动检查你要查找的注册表索引,并将其添加到你的 components.json 文件中。
🌐 When you run shadcn add or shadcn search, the CLI will automatically check the registry index for the registry you are looking for and add it to your components.json file.
你可以在 https://shadcn.nodejs.cn/r/registries.json 查看完整列表。
🌐 You can see the full list at https://shadcn.nodejs.cn/r/registries.json.
添加注册表
🌐 Adding a Registry
- 将你的注册表添加到
apps/v4/registry/directory.json - 运行
pnpm registry:build来更新registries.json文件。 - 创建一个拉取请求到 https://github.com/shadcn-ui/ui
一旦你提交了请求,团队将对其进行验证和审核。
🌐 Once you have submitted your request, it will be validated and reviewed by the team.
要求
🌐 Requirements
- 该注册表必须是开源的并且公开可访问。
- 注册表必须是符合 注册表模式规范 的有效 JSON 文件。
- 该注册表预计是一个扁平注册表,没有嵌套项,即预计
/registry.json和/component-name.json文件位于注册表的根目录。 files数组(如果存在)不得包含content属性。
这是一个有效注册表的例子:
🌐 Here's an example of a valid registry:
{
"$schema": "https://shadcn.nodejs.cn/schema/registry.json",
"name": "acme",
"homepage": "https://acme.com",
"items": [
{
"name": "login-form",
"type": "registry:component",
"title": "Login Form",
"description": "A login form component.",
"files": [
{
"path": "registry/new-york/auth/login-form.tsx",
"type": "registry:component"
}
]
},
{
"name": "example-login-form",
"type": "registry:component",
"title": "Example Login Form",
"description": "An example showing how to use the login form component.",
"files": [
{
"path": "registry/new-york/examples/example-login-form.tsx",
"type": "registry:component"
}
]
}
}
]
}