run-ios command ignores the verbose option
See original GitHub issueEnvironment
info Fetching system and libraries information...
System:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Memory: 1.47 GB / 16.00 GB
Shell: 5.8 - /usr/local/bin/zsh
Binaries:
Node: 10.24.0 - /var/folders/h6/g6rldscd6h389g9w42_7k_jm0swv2d/T/yarn--1617537855315-0.38815081056993295/node
Yarn: 1.22.10 - /var/folders/h6/g6rldscd6h389g9w42_7k_jm0swv2d/T/yarn--1617537855315-0.38815081056993295/yarn
npm: 6.14.11 - ~/.nvm/versions/node/v10.24.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.0 - /Users/liam.jones/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 23, 25, 26, 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.2, 29.0.3, 30.0.3, 31.0.0
System Images: android-21 | Google APIs Intel x86 Atom, android-25 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1.3 4.1.3
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_282 - /usr/bin/javac
Python: 3.9.2 - /usr/local/opt/python/libexec/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.4 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Description
run-ios detects the presence of xcpretty and uses it if installed. The command-line help for the run-ios command states:
–verbose Do not use xcpretty even if installed
However, when run with the verbose option, xcpretty is still used.
I’ve dug into this a little, it looks like the verbose option is checked for in buildProject()
, here: https://github.com/react-native-community/cli/blob/v4.14.0/packages/platform-ios/src/commands/runIOS/index.ts#L307
However, if I debug the command as it’s running, verbose is undefined
.
The issue seems to be coming from Command.prototype.opts()
inside commander. Here it copies the values from properties on this
(the Command) into result[key]
: https://github.com/tj/commander.js/blob/v2.20.3/index.js#L779. This works for other options like packager
(set via --no-packager
). I can see packager
, etc exist on this
for the working properties but for some reason this.verbose
doesn’t.
I’ve not been able to work out why this happens yet (nor if it’s a problem in the cli or commander).
I’ve also created a fresh RN 0.64.0 project to check the behaviour is the same (and it is).
Reproducible Demo
- Install xcpretty
- Create RN project
- Run
run-ios
and note xcpretty formatted output - Run
run-ios --verbose
and note xcpretty formatted output is still present
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Still waiting on PR #1571 to be approved and merged to fix this.
I would imagine we can pass
commander.verbose
https://github.com/react-native-community/cli/blob/641b21f583c97e3d48ce87d5fe804f42db92fa5c/packages/cli/src/index.ts#L28-L30 to here https://github.com/react-native-community/cli/blob/641b21f583c97e3d48ce87d5fe804f42db92fa5c/packages/cli/src/index.ts#L138We have tried upgrading to a newer version, but that was quite a challenge. I would say for now, the easiest workaround is to pass it this way, or provide a utility function
isVerboseMode()
that would checkprocess.argv
itself, like theinit
workaround you have linked.Either way, I’d be happy to accept this as a PR!