@@ -26,6 +26,7 @@ export function checkMainSourceFiles(): CheckResult[] {
2626}
2727
2828export function getMissingMainSourceFiles ( ) : CheckResult [ ] {
29+ console . log ( chalk . gray ( "|- Checking source files..." ) ) ;
2930 return checkMainSourceFiles ( ) . filter ( ( result ) => ! result . exists ) ;
3031}
3132
@@ -34,6 +35,7 @@ export function allMainSourceFilesExist(): boolean {
3435}
3536
3637function checkMDXFiles ( ) : Array < { file : string ; name : string ; line : number } > {
38+ console . log ( chalk . gray ( "|- Checking <CopyShadcnCommand /> Commands..." ) ) ;
3739 const projectRoot = process . cwd ( ) ;
3840 const docsFolder = join ( projectRoot , "src" , "docs" ) ;
3941 const missing : Array < { file : string ; name : string ; line : number } > = [ ] ;
@@ -80,12 +82,43 @@ function checkMDXFiles(): Array<{ file: string; name: string; line: number }> {
8082 return missing ;
8183}
8284
85+ function checkRegistryDependencies ( ) : Array < {
86+ title : string ;
87+ missingDependency : string ;
88+ } > {
89+ console . log ( chalk . gray ( "|- Checking registryDependencies..." ) ) ;
90+ const missing : Array < { title : string ; missingDependency : string } > = [ ] ;
91+
92+ const availableNames = new Set < string > (
93+ RegistryData . map ( ( item ) => item . shadcnRegistry ?. name ) . filter (
94+ ( name ) : name is string => ! ! name ,
95+ ) ,
96+ ) ;
97+
98+ RegistryData . forEach ( ( component ) => {
99+ const registryDeps = component . shadcnRegistry ?. registryDependencies ;
100+ if ( registryDeps && Array . isArray ( registryDeps ) ) {
101+ registryDeps . forEach ( ( dep ) => {
102+ if ( ! availableNames . has ( dep ) ) {
103+ missing . push ( {
104+ title : component . title ,
105+ missingDependency : dep ,
106+ } ) ;
107+ }
108+ } ) ;
109+ }
110+ } ) ;
111+
112+ return missing ;
113+ }
114+
83115function checkRegistry ( ) {
84116 console . log ( chalk . bold . blue ( "|- 🔍 Checking registry...\n" ) ) ;
85117
86118 const results = checkMainSourceFiles ( ) ;
87119 const missing = getMissingMainSourceFiles ( ) ;
88120 const mdxMissing = checkMDXFiles ( ) ;
121+ const registryDepsMissing = checkRegistryDependencies ( ) ;
89122
90123 if ( missing . length > 0 ) {
91124 console . log (
@@ -118,7 +151,23 @@ function checkRegistry() {
118151 } ) ;
119152 }
120153
121- if ( missing . length === 0 && mdxMissing . length === 0 ) {
154+ if ( registryDepsMissing . length > 0 ) {
155+ console . log (
156+ chalk . red . bold (
157+ `|- ❌ Missing ${ registryDepsMissing . length } registryDependencies references:` ,
158+ ) ,
159+ ) ;
160+ registryDepsMissing . forEach ( ( item ) => {
161+ console . log ( chalk . red ( "-" ) , chalk . white ( item . missingDependency ) ) ;
162+ console . log ( chalk . gray ( `-> Used in: ${ item . title } \n` ) ) ;
163+ } ) ;
164+ }
165+
166+ if (
167+ missing . length === 0 &&
168+ mdxMissing . length === 0 &&
169+ registryDepsMissing . length === 0
170+ ) {
122171 console . log ( chalk . green . bold ( "|- ✅ Registry checked successfully." ) ) ;
123172 process . exit ( 0 ) ;
124173 }
0 commit comments