registry.json 스키마

registry.json 스키마

나만의 컴포넌트 레지스트리를 직접 운영하고 싶다면 registry.json 스키마를 사용해요. 하나의 레지스트리에 여러 아이템을 담는 구조라서, 앞서 본 registry-item.json이 각 아이템의 상세 스키마를 담당한다고 보면 돼요.

출처: 문서

본문

registry.json 스키마는 커스텀 컴포넌트 레지스트리를 정의하는 데 사용돼요.

{
  "$schema": "https://ui.shadcn.com/schema/registry.json",
  "name": "shadcn",
  "homepage": "https://ui.shadcn.com",
  "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 Schema는 여기에서 직접 확인할 수 있어요.

$schema

$schema 속성은 registry.json 파일이 따르는 스키마를 지정하는 데 사용돼요.

{
  "$schema": "https://ui.shadcn.com/schema/registry.json"
}

name

name 속성은 레지스트리의 이름을 지정하는 데 사용돼요. 데이터 속성과 기타 메타데이터에 사용돼요.

{
  "name": "acme"
}

homepage

레지스트리의 홈페이지예요. 데이터 속성과 기타 메타데이터에 사용돼요.

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

items

레지스트리의 items 목록이에요. 각 항목은 registry-item 스키마 명세를 따라야 해요.

{
  "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"
        }
      ]
    }
  ]
}

자세한 내용은 registry-item 스키마 문서를 참고해요.

더 알아보기 (Learn more)