1082815dcSEvan Baconimport chalk from 'chalk'; 2082815dcSEvan Bacon 3082815dcSEvan Baconimport { ModPlatform } from '../Plugin.types'; 4082815dcSEvan Bacon 5082815dcSEvan Bacon/** 6082815dcSEvan Bacon * Log a warning that doesn't disrupt the spinners. 7082815dcSEvan Bacon * 8082815dcSEvan Bacon * ```sh 9082815dcSEvan Bacon * » android: android.package: property is invalid https://expo.fyi/android-package 10082815dcSEvan Bacon * ``` 11082815dcSEvan Bacon * 12082815dcSEvan Bacon * @param property Name of the config property that triggered the warning (best-effort) 13082815dcSEvan Bacon * @param text Main warning message 14082815dcSEvan Bacon * @param link Useful link to resources related to the warning 15082815dcSEvan Bacon */ 16082815dcSEvan Baconexport function addWarningAndroid(property: string, text: string, link?: string) { 17082815dcSEvan Bacon console.warn(formatWarning('android', property, text, link)); 18082815dcSEvan Bacon} 19082815dcSEvan Bacon 20082815dcSEvan Bacon/** 21082815dcSEvan Bacon * Log a warning that doesn't disrupt the spinners. 22082815dcSEvan Bacon * 23082815dcSEvan Bacon * ```sh 24082815dcSEvan Bacon * » ios: ios.bundleIdentifier: property is invalid https://expo.fyi/bundle-identifier 25082815dcSEvan Bacon * ``` 26082815dcSEvan Bacon * 27082815dcSEvan Bacon * @param property Name of the config property that triggered the warning (best-effort) 28082815dcSEvan Bacon * @param text Main warning message 29082815dcSEvan Bacon * @param link Useful link to resources related to the warning 30082815dcSEvan Bacon */ 31082815dcSEvan Baconexport function addWarningIOS(property: string, text: string, link?: string) { 32082815dcSEvan Bacon console.warn(formatWarning('ios', property, text, link)); 33082815dcSEvan Bacon} 34082815dcSEvan Bacon 35082815dcSEvan Baconexport function addWarningForPlatform( 36*edc75823SEvan Bacon platform: ModPlatform & string, 37082815dcSEvan Bacon property: string, 38082815dcSEvan Bacon text: string, 39082815dcSEvan Bacon link?: string 40082815dcSEvan Bacon) { 41082815dcSEvan Bacon console.warn(formatWarning(platform, property, text, link)); 42082815dcSEvan Bacon} 43082815dcSEvan Bacon 44082815dcSEvan Baconfunction formatWarning(platform: string, property: string, warning: string, link?: string) { 45082815dcSEvan Bacon return chalk.yellow`${'» ' + chalk.bold(platform)}: ${property}: ${warning}${ 46082815dcSEvan Bacon link ? chalk.gray(' ' + link) : '' 47082815dcSEvan Bacon }`; 48082815dcSEvan Bacon} 49