()
| 54 | * Utility to get the currently targeted platform name |
| 55 | */ |
| 56 | export function getPlatformName(): Platform { |
| 57 | if (env?.android) { |
| 58 | return 'android'; |
| 59 | } |
| 60 | |
| 61 | if (env?.ios) { |
| 62 | return 'ios'; |
| 63 | } |
| 64 | |
| 65 | if (env?.visionos || env?.vision) { |
| 66 | return 'visionos'; |
| 67 | } |
| 68 | |
| 69 | // support custom platforms |
| 70 | if (env?.platform) { |
| 71 | if (platforms[env.platform]) { |
| 72 | return env.platform; |
| 73 | } |
| 74 | |
| 75 | throw error(` |
| 76 | Invalid platform: ${env.platform} |
| 77 | |
| 78 | Valid platforms: ${getAvailablePlatforms().join(', ')} |
| 79 | `); |
| 80 | } |
| 81 | |
| 82 | warnOnce( |
| 83 | 'getPlatformName', |
| 84 | ` |
| 85 | You need to provide a target platform! |
| 86 | |
| 87 | Available platforms: ${Object.keys(platforms).join(', ')} |
| 88 | |
| 89 | Use --env.platform=<platform> or --env.android, --env.ios, --env.visionos to specify the target platform. |
| 90 | |
| 91 | Defaulting to "ios". |
| 92 | `, |
| 93 | ); |
| 94 | |
| 95 | return 'ios'; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Utility to get the entry file path for the currently targeted platform |
no test coverage detected