@@ -640,8 +640,8 @@ async function main() {
640640 await validateDirectoryFiles ( dir , directMetadataFile , directLogoPath ) ;
641641 } else {
642642 // This directory doesn't contain metadata.json directly
643- // Check if it contains subdirectories with metadata.json
644- console . log ( ` - 🔍 Checking for app subdirectories...` ) ;
643+ // Check if it contains subdirectories with metadata.json (repositories/owner/repo/app structure)
644+ console . log ( ` - 🔍 Checking for repository subdirectories...` ) ;
645645
646646 const subdirs = fs . readdirSync ( dir , { withFileTypes : true } )
647647 . filter ( dirent => dirent . isDirectory ( ) )
@@ -654,17 +654,51 @@ async function main() {
654654 const subdirLogoPath = path . join ( subdirPath , 'logo.png' ) ;
655655
656656 if ( fs . existsSync ( subdirMetadataFile ) ) {
657+ // Direct metadata.json in repo directory
657658 foundApps = true ;
658- console . log ( ` - 📁 App subdirectory : \`${ subdir } \`` ) ;
659+ console . log ( ` - 📁 Repository : \`${ subdir } \`` ) ;
659660 await validateDirectoryFiles ( subdirPath , subdirMetadataFile , subdirLogoPath ) ;
661+ } else {
662+ // Check for app subdirectories within this repo directory
663+ console . log ( ` - 📁 Repository: \`${ subdir } \`` ) ;
664+ console . log ( ` - 🔍 Checking for app subdirectories...` ) ;
665+
666+ try {
667+ const appSubdirs = fs . readdirSync ( subdirPath , { withFileTypes : true } )
668+ . filter ( dirent => dirent . isDirectory ( ) )
669+ . map ( dirent => dirent . name ) ;
670+
671+ let foundAppsInRepo = false ;
672+ for ( const appSubdir of appSubdirs ) {
673+ const appSubdirPath = path . join ( subdirPath , appSubdir ) ;
674+ const appMetadataFile = path . join ( appSubdirPath , 'metadata.json' ) ;
675+ const appLogoPath = path . join ( appSubdirPath , 'logo.png' ) ;
676+
677+ if ( fs . existsSync ( appMetadataFile ) ) {
678+ foundApps = true ;
679+ foundAppsInRepo = true ;
680+ console . log ( ` - 📁 App subdirectory: \`${ appSubdir } \`` ) ;
681+ await validateDirectoryFiles ( appSubdirPath , appMetadataFile , appLogoPath ) ;
682+ }
683+ }
684+
685+ if ( ! foundAppsInRepo ) {
686+ console . log ( ` - 📄 \`metadata.json\`` ) ;
687+ console . log ( ` - ❌ File not found in any app subdirectories` ) ;
688+ console . log ( ` - 📄 \`logo.png\`` ) ;
689+ console . log ( ` - ❌ File not found in any app subdirectories` ) ;
690+ }
691+ } catch ( error ) {
692+ console . log ( ` - ❌ Error reading repository directory: ${ error . message } ` ) ;
693+ }
660694 }
661695 }
662696
663697 if ( ! foundApps ) {
664698 console . log ( ` - 📄 \`metadata.json\`` ) ;
665- console . log ( ` - ❌ File not found` ) ;
699+ console . log ( ` - ❌ File not found in any subdirectories ` ) ;
666700 console . log ( ` - 📄 \`logo.png\`` ) ;
667- console . log ( ` - ❌ File not found` ) ;
701+ console . log ( ` - ❌ File not found in any subdirectories ` ) ;
668702 }
669703 }
670704
0 commit comments