diff --git a/lib/controllers/platform-controller.ts b/lib/controllers/platform-controller.ts index 2203c1a56e..e0e2b99974 100644 --- a/lib/controllers/platform-controller.ts +++ b/lib/controllers/platform-controller.ts @@ -143,6 +143,23 @@ export class PlatformController implements IPlatformController { const hasPlatformDirectory = this.$fs.exists( path.join(projectData.platformsDir, platformName) ); + + if (hasPlatformDirectory) { + const platformDirectoryItemCount = this.$fs.readDirectory( + path.join(projectData.platformsDir, platformName) + ).length; + + // 5 is a magic number to approximate a valid platform folder + // any valid platform should contain at least 5 files + // we choose 5 to avoid false-positives due to system files like .DS_Store etc. + if (platformDirectoryItemCount <= 5) { + this.$logger.warn( + `The platforms/${platformName} folder appears to be invalid. If the build fails, run 'ns clean' and rebuild the app.`, + { wrapMessageWithBorders: true } + ); + } + } + const shouldAddNativePlatform = !nativePrepare || !nativePrepare.skipNativePrepare; const prepareInfo = this.$projectChangesService.getPrepareInfo(