Comments (13)
@stovmascript I did a bit search and I found out there's not a full-proof way to understand if a RN expo project is ejected (or bare flow) or not.
What I think of creating as PR is to have an additional option in CLI to force updating of native files even if expo has been detected. And leave it up to the user to fix his situation.
Or something like --ignore-expo
totally.
from react-native-version.
I'm actually more inclined to do it the other way around and introduce some --expo
option for Expo projects. That way, there wouldn't be a need for any "isExpoProject" logic. On the other hand, it would be a breaking change, but I guess it's not that big of a deal for people to add a flag to their setups.
from react-native-version.
As a workaround, you may convert your app.json
to a app.config.js
file, which prevents react-native-version
from detecting it as a managed Expo project.
from react-native-version.
@stovmascript if the Pullrequest could be accepted it would be awesome!
I'm having the same problems with an ejected expo app, not actually updating the version numbers.
from react-native-version.
I would absolutely love an --expo
option. As of now, I am still using app.json information even though the project is ejected, so simply deleting does not do the trick.
In the meantime I am just bypassing the problem by adding sth. like this in my package.json
scripts for example:
"bump:build": "yarn react-native-version -b && mv app.json app--.json && yarn react-native-version -b && mv app--.json app.json"
from react-native-version.
As a workaround, you may convert your
app.json
to aapp.config.js
file, which preventsreact-native-version
from detecting it as a managed Expo project.
I just tried this workaround and got it to work. Minor correction for future searchers. You'll want to convert your app.json
into an app.config.json
file.
from react-native-version.
@stovmascript Even if expo is ejected, there are modules that use expo
key in app.json. I think it is a good idea to introduce --ignore-expo
option.
ex.) expo-updates - npm
from react-native-version.
@jeremybdk Sorry for not replying earlier, I'm pretty busy atm, also in the middle of moving.
Seems like that could work. Would you like to submit a PR? The check whether the app is an Expo app or plain RN is here:
Lines 69 to 78 in 89fa937
It should be pretty easy to test. Maybe some other tweaks will be required to update both the Expo config and the RN app, when ejected - if that's what we want.
from react-native-version.
@killerchip What about removing the expo
key from app.json after ejecting? Is it needed for usage with the Expo SDK after ejecting? (Sorry, I don't use Expo.)
from react-native-version.
@stovmascript I'm using expo but not an expo expert myself.
My tests showed:
-
Using expo-cli to initiate an expo-bare workflow, it does create the expo key in
app.json
. Removing it has not issue. The app run fine. -
Using the expo-cli to initial an expo-managed workflow, and then
eject
, cannot compile my app at all. So I could not tested it at atm.
Anyway, the solution I'm proposing is not obtrusive. It's an opt-in and removes the concern of managing edge cases with expo from your package, and gives this flexibility to user.
But it's your call in the end :-)
from react-native-version.
Another option would be to include instructions on how to update the Android and iOS build steps to READ the version information from the "app.json" file.
Here's an easy way to do it in Android:
android/app/build.gradle
def appJson = new groovy.json.JsonSlurper().parse(new File("$rootDir/../app.json"))
// ...
defaultConfig {
// ...
versionCode appJson.expo.android.versionCode
versionName appJson.expo.version
for iOS I found this suggested solution
from react-native-version.
for iOS I found this suggested solution
@cjthompson I have tried below for iOS but its not working for me, version and buildNumber doesn't change.
// iOSVersioning.js, placed inside ios folder
/** @format */
const { exec } = require('child_process')
const APP_VERSION = process.env.APP_VERSION
const app = require('../app.json')
const versionName = app.version
const buildNumber = app.ios.buildNumber
if (APP_VERSION === versionName) {
process.exit()
}
exec(
`/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${versionName}" -c "Set :CFBundleVersion ${buildNumber}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"`,
(err, stdout, stderr) => {
if (err) {
console.log('Failed to apply the app version.')
process.exit(1)
}
console.log(`Applied app version: ${versionName}, build number: ${buildNumber}`)
}
)
and changed my Bundle React Native code and images
build phase to:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
AppVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}")
APP_VERSION="$AppVersion" node ${PROJECT_DIR}/../iOSVersioning.js
export NODE_BINARY=$(which node)
../node_modules/react-native/scripts/react-native-xcode.sh
../node_modules/expo-constants/scripts/get-app-config-ios.sh
../node_modules/expo-updates/scripts/create-manifest-ios.sh
can you share how you configured it for iOS?
from react-native-version.
Please apply one of these two PR's which would fix the issue:
--ignore-expo cli option by killerchip ยท Pull Request #150
from react-native-version.
Related Issues (20)
- increse buildNumber on hot reload HOT 1
- Just to verify: there is NO option to NOT let the tool commit into git? HOT 2
- increase with widget targers version
- Command failed with exit code 127
- Support for multiple info plist files?
- npm version [major/minor/patch] is not updating all the files
- I don't want to increase verssion on all Project HOT 2
- fatal: No names found, cannot describe anything. HOT 1
- SUPPORT
- Support iOS Extensions target HOT 2
- Cannot increase only build number
- Change version for a specific IOS target
- Rely on an argument for expo and react-native projects
- versionName and CFBundleShortVersionString dont output the expected inputs
- Fails when xCode has more targets (multiple Info.plis)
- What's an alternative to this package? HOT 2
- Need monorepo support
- How can I also customize updating files to add for example updating OneSignal version and build Id ?
- Add --skip-expo option to skip Expo versioning even if detected HOT 1
- SyntaxError: Expected "\"", "\\'", "\\\"", "\\n", or [^\\"] but "\\" found. HOT 7
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 react-native-version.