react-native-community / cli

The React Native Community CLI - command line tools to help you build RN apps
MIT License
2.41k stars 905 forks source link

fix: config fails to load with --platform flag #2470

Closed TMisiukiewicz closed 3 months ago

TMisiukiewicz commented 3 months ago

Summary:

When dependency does not have platforms property in dependency config, the config command was breaking when passing --platform [platformName] when it was trying to read platforms from such dependencies.

E.g. @react-native-webapis/web-storage contains react-native.config.js file where platforms are not defined, so config was breaking when trying to access it.

Closes #2463

Test Plan:

  1. Run node ./path-to-cli/cli/build/bin.js config --platform ios
  2. Verify the output was returned properly
  3. Run node ./path-to-cli/cli/build/bin.js config --platform android
  4. Verify the output was returned properly

Checklist

szymonrybczak commented 3 months ago

@micaww mind checking if the solution work? To test this change you can simple change the line inside node_modules/@react-native-community/cli-config/...