react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

feat: support custom firebase.json path

Open CHOIMINSEOK opened this issue 1 year ago • 2 comments

Description

Currently, the firebase.json file is configured only when it is located in the parent directory of the Android project. However, React Native can be used in different ways, especially when integrating it into an existing native project.

In my case, I’m trying to integrate a React Native app into a brownfield native app as a submodule, so retrieving firebase.json from the upper directory always fails. I think providing an option to set a custom "firebaseJsonDir" would be very useful for people in my situation.

I add "customFirebaseJsonDir" option in same way to override firebase sdk versions and reactNativeDir.

I would appreciate any help to add this feature on iOS too.

Release Summary

  • Support custom firebase.json path

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [x] Yes
  • My change supports the following platforms;
    • [x] Android
    • [ ] iOS
  • My change includes tests;
    • [ ] e2e tests added or updated in packages/\*\*/e2e
    • [ ] jest tests added or updated in packages/\*\*/__tests__
  • [x] I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • [ ] Yes
    • [x] No

CHOIMINSEOK avatar Oct 15 '24 12:10 CHOIMINSEOK

The latest updates on your projects. Learn more about Vercel for Git ā†—ļøŽ

Name Status Preview Comments Updated (UTC)
react-native-firebase āœ… Ready (Inspect) Visit Preview šŸ’¬ Add feedback Oct 15, 2024 1:01pm

vercel[bot] avatar Oct 15 '24 12:10 vercel[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 15 '24 12:10 CLAassistant

Hmm - the iOS side does a search for firebase.json in two places:

1- one in shell script installed as a build script inside the Xcode project, during build in order to pull values that it needs to put in the Info.plist:

https://github.com/invertase/react-native-firebase/blob/d55e891064d7343788526f688d303dd01c2484c4/packages/app/ios_config.sh#L77-L87

2- one in ruby which is pulled in to the RNFBApp podspec to get the SDK versions

https://github.com/invertase/react-native-firebase/blob/d55e891064d7343788526f688d303dd01c2484c4/packages/app/firebase_json.rb#L35-L59

I am not sure how to transmit to the Xcode build script that you have a specific firebase.json path, the only thing I can think of is an environment variable. For firebase_json.rb it could be a Podfile variable perhaps

I wonder if, in all these cases, it might be easier as part of your build / package process to determine which directories are actually being searched...and during build make sure the firebase.json is just copied/placed into a directory that is already searched?

That might be easier than complicating the build / config process here (which is already pretty touchy...)

mikehardy avatar Oct 31 '24 12:10 mikehardy

Hi! @mikehardy Thanks for reply.

I wonder if, in all these cases, it might be easier as part of your build / package process to determine which directories are actually being searched...and during build make sure the firebase.json is just copied/placed into a directory that is already searched?

Yeah that might work, but all of those who have different rn app structure have to feature out where the build script of react-native-firebase resolves firebase.json. I just want to provide a convenient option for them. Besides, in some case like me the location might be outside of project which is so weird.

directory <= this is where react-native-firebase starts to resolve firebase.json
 ć„“ android project
  ć„“ react native project

CHOIMINSEOK avatar Nov 11 '24 15:11 CHOIMINSEOK

Hello šŸ‘‹, this PR has been opened for more than 2 months with no activity on it.

If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing!

You have 15 days until this gets closed automatically

github-actions[bot] avatar Dec 09 '24 15:12 github-actions[bot]