File tree Expand file tree Collapse file tree
test/utils/schema/__snapshots__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " shadcn " : patch
3+ ---
4+
5+ add docs support
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export const registryEntrySchema = z.object({
6262 category : z . string ( ) . optional ( ) ,
6363 subcategory : z . string ( ) . optional ( ) ,
6464 chunks : z . array ( blockChunkSchema ) . optional ( ) ,
65+ docs : z . string ( ) . optional ( ) ,
6566} )
6667
6768export const registrySchema = z . array ( registryEntrySchema )
Original file line number Diff line number Diff line change 11import { type Config } from "@/src/utils/get-config"
22import { handleError } from "@/src/utils/handle-error"
3+ import { logger } from "@/src/utils/logger"
34import { registryResolveItemsTree } from "@/src/utils/registry"
45import { spinner } from "@/src/utils/spinner"
56import { updateCssVars } from "@/src/utils/updaters/update-css-vars"
@@ -48,4 +49,8 @@ export async function addComponents(
4849 overwrite : options . overwrite ,
4950 silent : options . silent ,
5051 } )
52+
53+ if ( tree . docs ) {
54+ logger . info ( tree . docs )
55+ }
5156}
Original file line number Diff line number Diff line change @@ -321,6 +321,13 @@ export async function registryResolveItemsTree(
321321 cssVars = deepmerge ( cssVars , item . cssVars ?? { } )
322322 } )
323323
324+ let docs = ""
325+ payload . forEach ( ( item ) => {
326+ if ( item . docs ) {
327+ docs += `${ item . docs } \n`
328+ }
329+ } )
330+
324331 return registryResolvedItemsTreeSchema . parse ( {
325332 dependencies : deepmerge . all (
326333 payload . map ( ( item ) => item . dependencies ?? [ ] )
@@ -331,6 +338,7 @@ export async function registryResolveItemsTree(
331338 files : deepmerge . all ( payload . map ( ( item ) => item . files ?? [ ] ) ) ,
332339 tailwind,
333340 cssVars,
341+ docs,
334342 } )
335343 } catch ( error ) {
336344 handleError ( error )
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ export const registryItemSchema = z.object({
4646 tailwind : registryItemTailwindSchema . optional ( ) ,
4747 cssVars : registryItemCssVarsSchema . optional ( ) ,
4848 meta : z . record ( z . string ( ) , z . any ( ) ) . optional ( ) ,
49+ docs : z . string ( ) . optional ( ) ,
4950} )
5051
5152export type RegistryItem = z . infer < typeof registryItemSchema >
@@ -82,4 +83,5 @@ export const registryResolvedItemsTreeSchema = registryItemSchema.pick({
8283 files : true ,
8384 tailwind : true ,
8485 cssVars : true ,
86+ docs : true ,
8587} )
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ exports[`registryResolveItemTree > should resolve index 1`] = `
2020 " tailwind-merge" ,
2121 ],
2222 " devDependencies" : [],
23+ " docs" : " " ,
2324 " files" : [
2425 {
2526 " content" : " " use client "
@@ -93,6 +94,7 @@ exports[`registryResolveItemTree > should resolve items tree 1`] = `
9394 " @radix-ui/react-slot" ,
9495 ],
9596 " devDependencies" : [],
97+ " docs" : " " ,
9698 " files" : [
9799 {
98100 " content" : " import * as React from " react "
@@ -171,6 +173,7 @@ exports[`registryResolveItemTree > should resolve multiple items tree 1`] = `
171173 " @radix-ui/react-dialog" ,
172174 ],
173175 " devDependencies" : [],
176+ " docs" : " " ,
174177 " files" : [
175178 {
176179 " content" : " import * as React from " react "
You can’t perform that action at this time.
0 commit comments