1import { ModPlatform } from '@expo/config-plugins'; 2import chalk from 'chalk'; 3import path from 'path'; 4 5import * as Log from '../log'; 6import { directoryExistsAsync } from '../utils/dir'; 7 8export async function validateTemplatePlatforms({ 9 templateDirectory, 10 platforms, 11}: { 12 templateDirectory: string; 13 platforms: ModPlatform[]; 14}) { 15 const existingPlatforms: ModPlatform[] = []; 16 17 for (const platform of platforms) { 18 if (await directoryExistsAsync(path.join(templateDirectory, platform))) { 19 existingPlatforms.push(platform); 20 } else { 21 Log.warn( 22 chalk`⚠️ Skipping platform ${platform}. Use a template that contains native files for ${platform} (./${platform}).` 23 ); 24 } 25 } 26 27 return existingPlatforms; 28} 29