Modified React Native modulus and silences warnings.
Yes.
When using React Native with it's core / third party frameworks Xcode generated allot of warnings. Most of the warnings aren't causing any harm and can be ignored for the time being. At the same time, these warnings obscure warnings from the projects you're managing. Having a project with 100+ warnings, of which 1 or 2 are caused by your own code is frustrating.
Don't get me wrong, these warnings should be properly fixed! But not in our day-to-day workspace :)
It scans for ./node_modules/**/*.xcodeproj/project.pbxproj files and applied the following changes to all build configurations:
GCC_WARN_INHIBIT_ALL_WARNINGS=YESRUN_CLANG_STATIC_ANALYZER=NOLastUpgradeCheck=9999
- Make flags configurable, especially the value of
LastUpgradeCheckis ideal to specify explicitly. - Allow adding / overwriting of any build settings
- Whitelist / Blacklist specific projects
- More? Let me know.
yarn add --dev react-native-inhibit-warnings
or
npm install --save-dev react-native-inhibit-warnings
Once the package is installed in your project, you just need to configure it by adding a postinstall script which will re-run the script whenever you add or remove packages to/from your project:
{
"name": "your-awesome-app",
"version": "1.0.0",
"scripts": {
"postinstall": "react-native-inhibit-warnings"
},
}As long as react-native-inhibit-warnings has run whenever you add react native modules, you should be good to go.
A good starting point for troubleshooting is:
- Completely quit Xcode.
rm -rf node_modulesyarnornpm i- Re open Xcode
- Product -> Clean
- Run
If you're still having trouble, post an issue so we can look into it.
You can run this package manually with react-native-inhibit-warnings.
The best way to give yourself a manual trigger for this is add to your package.json scripts section like so:
{
"name": "your-awesome-app",
"version": "1.0.0",
"scripts": {
"inhibit-warnings": "react-native-inhibit-warnings",
"postinstall": "react-native-inhibit-warnings"
}
}You can then yarn run inhibit-warnings or npm run inhibit-warnings which will run the cleanup scripts on demand.
If you decide this isn't working out for you, we'd love to know why and to try to fix it. Please open an issue.
But if you still want to get rid of this and revert the changes to your project, you can follow these steps:
- Quitting Xcode.
rm -rf node_modulesyarnornpm i- Re-open Xcode.
You're back to where you started!
Licensed under the MIT License, Copyright © 2017 mattijsf.
See LICENSE for more information.