Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions lib/controllers/platform-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down