From 2ca7bec0c2a7d821ceaaf39840a6cdc5eceb8678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Kwas=CC=81niewski?= Date: Thu, 8 Feb 2024 09:52:55 -0800 Subject: [PATCH] fix: [Codegen] log supported apple platforms if there are any (#42819) Summary: This PR adds check if there are any supported platforms to log. For built-in modules this was logging empty line (as some of them doesn't contain podspecs): ![CleanShot 2024-02-02 at 15 54 42@2x](https://github.com/facebook/react-native/assets/52801365/c7e36052-9c48-4e00-a539-6ee5d528bbee) ## Changelog: [GENERAL] [FIXED] - Log Codegen supported platforms if any are available Pull Request resolved: https://github.com/facebook/react-native/pull/42819 Test Plan: Run Codegen and check if it prints empty `Supported Apple platforms` Reviewed By: cortinico Differential Revision: D53566301 Pulled By: cipolleschi fbshipit-source-id: 3f6b6d3b44da1ab7174432a5fac7f7d3fde11103 --- .../scripts/codegen/generate-artifacts-executor.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor.js b/packages/react-native/scripts/codegen/generate-artifacts-executor.js index fc98288592f..f5bb104a76f 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor.js @@ -193,12 +193,18 @@ function extractSupportedApplePlatforms(dependency, dependencyPath) { {}, ); - console.log( - `[Codegen] Supported Apple platforms: ${Object.keys(supportedPlatformsMap) - .filter(key => supportedPlatformsMap[key]) - .join(', ')} for ${dependency}`, + const supportedPlatformsList = Object.keys(supportedPlatformsMap).filter( + key => supportedPlatformsMap[key], ); + if (supportedPlatformsList.length > 0) { + console.log( + `[Codegen] Supported Apple platforms: ${supportedPlatformsList.join( + ', ', + )} for ${dependency}`, + ); + } + return supportedPlatformsMap; }