Comments (11)
So, we removed creating react-native.config.js
file from init
command in #2203. Also we re-generated diff for Upgrade Helper, so that when in 0.73.0 and 0.73.1 react-native.config.js
is no more visible 👍
We're now asking user if they want to install pods during init
, added in: #2204
from cli.
I second @rickhanlonii thoughts as we should strive to don't manipulate the template in the init
command.
@rickhanlonii indeed it shouldn't be displayed in the upgrade helper. Initially our idea was to support automatic pods installation without any additional setup, however we decided to hide this feature behind this flag and enable it by default only for freshly started projects. For all the projects upgrading to newest version this should be optional, as there might be various reasons where this workflow would not fit:
Can we do the following changes instead:
- Assume
automaticPodsInstallation == true
for everyone in 0.73 (both newly created and upgrade projects) - Remove the
react-native.config.js
file generation in theinit
command - Update the release blogpost to mention that this is a behavior change, and explain how to opt-out
- (Optional) show a message on the first
build-ios
/run-ios
that is triggeringpod install
by saying:
Starting with React Native 0.73, we will now
pod install
automatically if you attempt tobuild-ios
/run-ios
and you haven't runpod install
before. You can opt-out from this behavior by settingautomaticPodsInstallation = false
in yourreact-native.config.js
file as described here
from cli.
@tido64 what are your thoughts about it? I remember we discussed that when it was initially introduced
The current implementation is flawed and will break all existing setups internally at Microsoft. There is no way you can ship this as opt-out in its current shape. For transparency, here's the list of issues I posted:
- It assumes how and where CocoaPods is installed
- It calls
bundle exec pod install
, which assumes that users installed CocoaPods via RubyGems. This may not always be the case — you can also install it with Homebrew or MacPorts. CI services may be even more creative. - Even if CocoaPods was installed via RubyGems, it could've been done on the user global level. Meaning that it will fail if the current
Gemfile
does not include CocoaPods. Ruby will throw an exception if that's the case, failingrun-ios
. This is the original issue I reported in the 0.73 roadmap discussion.
- It calls
- The current implementation does not reuse the hashes in
Podfile.lock
andPods/Manifest.lock
. This means that it won't pick up changes that are done outsidepackage.json
. For instance, if someone updatedyarn.lock
only. pod install
is prohibitively expensive on larger projects. We have apps where this can take 30 minutes or more. It's so slow, they check in thePods
folder so that devs don't have to run it unless they're updating dependencies. With this version, if you pull down the latest changes and there have been dependency updates, CLI will unnecessarily runpod install
. This is a big no for us.- Checking in
Pods
folder is common practice: https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
from cli.
@tido64 do you have suggestions on how to make it better?
Besides fixing all the issues? How about not making run-ios
do so many things? Personally, I would prefer telling people to run doctor
instead. You can add as many fixers as you want there instead.
Edit: As for immediate actions: Make it opt in. Make sure its flaws are documented.
from cli.
from cli.
Personally, I feel like when I run the init command, I should be able to see all of the same files created in the react-native template repo. And since this is already there, I would probably just check it in.
from cli.
The default value of this option is true, right? Why create the file at all then? Why not include instructions for setting it to false if you don't want the behavior, no file needed?
from cli.
@rickhanlonii indeed it shouldn't be displayed in the upgrade helper. Initially our idea was to support automatic pods installation without any additional setup, however we decided to hide this feature behind this flag and enable it by default only for freshly started projects. For all the projects upgrading to newest version this should be optional, as there might be various reasons where this workflow would not fit:
- the template is using RubyGems to install CocoaPods (and CLI covers that scenario), but e.g. brownfield setups might be slightly different and use e.g Homebrew
- CocoaPods might be installed by RubyGems, but on the user global level
pod install
is expensive and might take a lot of time on complex projects. Those kind of projects very often have Pods directory checked into source control sopod install
is not desired
For those reasons, we wanted to run pod install
when using ios-specific commands by default only for projects started with init
from version 0.73. It runs automatically if pods are not installed, or there is a new native dependency discovered in config, so user don't have to remember about installing pods manually. A warning that it might not work properly when upgrading RN is in the docs. This workflow also speeds up the init
process, where pods installation is optional now.
I already checked Upgrade Helper but couldn't find anything that prevents from showing specific files. Maybe it can be done in rn-diff-purge
? Would love to get in touch with someone maintaining it to find the proper solution. An alternative solution is adding a comment in the file itself, indicating that it is created by the CLI and it's optional when upgrading to newer RN version, however I'd prefer that file to not be displayed at all.
from cli.
One more solution that comes to my mind is creating this file only if process.env.CI
is false
, I assume diff-purge
is running a job to generate a fresh project for each version. I assume init
is not a command that is ran on CIs heavily, it should not break anything for those who do that.
from cli.
@tido64 what are your thoughts about it? I remember we discussed that when it was initially introduced
from cli.
The current implementation is flawed and will break all existing setups internally at Microsoft. There is no way you can ship this as opt-out in its current shape. For transparency, here's the list of issues I posted:
@tido64 do you have suggestions on how to make it better?
from cli.
Related Issues (20)
- error index.js: Cannot read properties of undefined (reading 'match'). HOT 1
- How do you set mode with 'react-native start'? HOT 3
- Error on fresh projects in Lauching app in the emulator, RN -v 0.73 - Starting: intent HOT 3
- sdk version problem HOT 1
- Something is trying to use the devDependency 'metro-config' when building a production release build HOT 4
- Fail to download yarn if there is expired GITHUB_TOKEN HOT 4
- Android SDK: Not Found HOT 1
- Project initialization hangs HOT 5
- Failure of pod install for the React Native project using Yarn Berry - Yarn 3.x or 4.x. HOT 3
- Getting Error While initialization react native app in ubuntu HOT 13
- Undeclared identifer in OnLoad.cpp.o HOT 11
- Able to build ios app but unable to get build settings to deplou HOT 6
- Handle prompts in `init` command HOT 1
- React Native Build Failed After update build.gradle compileSdkVersion=34
- Read main activity from manifest not correctly handling activities with "missing" intent nodes HOT 3
- How to fix CompileC normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'Pods-urbex' from project 'Pods') failure in react-native ios HOT 2
- Experimental debugger support for custom hostnames HOT 2
- AndroidManifest.xml intent-filter error HOT 3
- please Help me I can't fix this error HOT 3
- Build Failed HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.