How to programmatically replace GoogleService-Info.plist file in iOS project

Hi guys, I have an ionic/angular/firebase/capacitor project. I use two distinct firebase projects for it, one for development and one for production. My problem: I am trying to come up with a script or any other programmatic way to replace GoogleService-Info.plist in such a way that the iOS app works after ionic run or ionic build. To explain myself, it is easy to write a script that simply replaces the file in the iOS folder but that does not seem to work. The replacement works only if I manually drop the GoogleService-Info.plist into Xcode and Xcode does its thing. I am looking for a way to avoid having to do this manually every time I switch between the development and production environment upon building the iOS app.

If no one answers you and you remember to ping me on monday (after my vacation) i can help you :smiley: I did this in a white-labeled app project

@EinfachHans thnx man, I posted this on several forums, had no luck so far.

i can give you my Working code on monday. If you would like to try yourself, i used this: xcode - npm