Closed sharvilak11 closed 1 year ago
I have not used it with an expo managed workflow and have no intentions of testing that myself anytime soon. Feel free to try it though and let me know!
Hi!
I created an Expo app to test the managed workflow but it seems your plugin doesn't work:
npx create-expo-app@latest --template tabs@sdk-49
npx expo install react-native-code-push
"plugins": [
"expo-router",
[
"./app.plugin",
{
"android": {
"CodePushDeploymentKey": "YOUR_ANDROID_CODE_PUSH_KEY"
},
"ios": {
"CodePushDeploymentKey": "YOUR_IOS_CODE_PUSH_KEY"
}
}
]
],
npx expo start
but got:
Starting project at .../react-native-code-push-expo-plugin-managed-workflow
Error: Cannot find module './plugin/src'
Require stack:
Is there something I can do to try o solve the issue?
Thanks in advise!
I think your plugin should work in managed workflow as at compile timeeas build
will eject the project to a temp folder and run all build comands like a bare workflow project.
Error: Cannot find module './plugin/src' That indicates that you didn't put the plugin in the right location. You might need to check your script to see if it's looking for it in a different location.
Hi! would you please double check if I put the files correctly, just uploaded to a repo my fresh created project for testing this.
https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow
Just to mention, in a production project I had to add a custom plugin to change some gradle properties in the managed workflow and worked like this
plugins: [
['./plugins/withCustomGradleProperties']
],
With file placed in PROJECT_ROOT/plugins/withCustomGradleProperties.js
Hi! would you please double check if I put the files correctly, just uploaded to a repo my fresh created project for testing this.
https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow
I've looked this over and the only thing I noticed that may be an issue is that I don't see @expo/config-plugins in your package.json dependencies.
You may want to consider reading the documentation on expo plugins at https://docs.expo.dev/config-plugins/introduction/
I don't provide much support for this as it was simply something I dumped here in the hopes that I might help someone out. Still hoping that react-native-code-push picks it up and adds it to their repo.
Good luck, let me know if you figure it out. It might help someone else who it trying to get this to work.
Well, got it working, at least now my expo server starts. Check repo.
Installed @expo/config-plugins Renamed your build folder to the plugin name and put ir into the plugins folder (this is only cosmetics) Called plugin like this
"plugins": [
"expo-router",
[
"./plugins/react-native-code-push-expo-plugin",
{
"android": {
"CodePushDeploymentKey": "YOUR_ANDROID_CODE_PUSH_KEY"
},
"ios": {
"CodePushDeploymentKey": "YOUR_IOS_CODE_PUSH_KEY"
}
}
]
],
Next week will try to code the suggestions in the codepush repo PR
Awesome! Great work
Well, got it working, at least now my expo server starts. Check repo.
Installed @expo/config-plugins Renamed your build folder to the plugin name and put ir into the plugins folder (this is only cosmetics) Called plugin like this
"plugins": [ "expo-router", [ "./plugins/react-native-code-push-expo-plugin", { "android": { "CodePushDeploymentKey": "YOUR_ANDROID_CODE_PUSH_KEY" }, "ios": { "CodePushDeploymentKey": "YOUR_IOS_CODE_PUSH_KEY" } } ] ],
Next week will try to code the suggestions in the codepush repo PR
hey @mgscreativa Is your project working perfectly? i have a problem with this plugin, can you take a look around? https://github.com/deggertsen/react-native-code-push-expo-plugin/issues/4
Hi! I just updated a test repo here https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow
The plugin seems to run but I thinks that as I left it unconfigured, starting the deb build fails with message TypeError: 0, _reactNativeCodePush.default is not a function (it is undefined)
I have 0 experience with code push so I need to start reading so I can get those code push keys for iOS and Android and I have no time to check that.
Maybe If you are experienced with CodePush you can test my repo
Hi! Another update (repo here https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow)
I was able to create a development build (development profile) and managed to run the app and start expo, the boudle got created and it seems CodePush is working, see logs:
LOG [CodePush] Checking for update. LOG [CodePush] An unknown error occurred. LOG [CodePush] 404: No deployment found.
I left everything unconfigured so those logs make sense...
Well It seems I hit a CodePush limitation, because appcenter codepush release-react
tries to get /android and /ios folders in project workspace, but since I'm trying to do this into an Expo managed workflow project, it fails, because those folders doesn't exists in Expo projects.
appcenter codepush release-react -a mgscreativa/android-expo-code-push-plugin-managed-workflow --deployment-name "Development" --entry-file App.tsx --use-hermes
Detecting android app version:
Error: Command 'codepush release-react -a mgscreativa/android-expo-code-push-plugin-managed-workflow --deployment-name Development --entry-file App.tsx --use-hermes' failed with exception "ENOENT: no such file or directory, lstat 'android/app'"
appcenter codepush release-react -a mgscreativa/ios-expo-code-push-plugin-managed-workflow --deployment-name "Development" --entry-file App.tsx --use-hermes
Detecting ios app version:
Error: Command 'codepush release-react -a mgscreativa/ios-expo-code-push-plugin-managed-workflow --deployment-name Development --entry-file App.tsx --use-hermes' failed with exception "Unable to find either of the following plist files in order to infer your app's binary version: "ios/react-native-code-push-expo-plugin-managed-workflow/Info.plist", "ios/Info.plist". If your plist has a different name, or is located in a different directory, consider using either the "--plist-file" or "--plist-file-prefix" parameters to help inform the CLI how to find it."
Any help is really appreciated!
@deggertsen can you take a look?
New update!
If I manually add the --target-binary-version option, It starts the boundler but it fails to bundle the code
appcenter codepush release-react -a mgscreativa/ios-expo-code-push-plugin-managed-workflow --deployment-name "Development" --entry-file App.tsx --use-hermes --target-binary-version 1.0.0
Running "react-native bundle" command:
node node_modules/.bin/react-native bundle --assets-dest /tmp/code-push202378-13714-1aqtsrk.ef28/CodePush --bundle-output /tmp/code-push202378-13714-1aqtsrk.ef28/CodePush/main.jsbundle --dev false --entry-file App.tsx --platform ios warn From React Native 0.72, your metro.config.js file should extend'@react-native/metro-config'. Please see the React Native 0.72 changelog, or copy the template at: https://github.com/facebook/react-native/blob/main/packages/react-native/template/metro.config.js warn Falling back to internal defaults. Welcome to Metro v0.76.7 Fast - Scalable - Integrated
error Unable to resolve module @/components/EditScreenInfo from /media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/app/(tabs)/two.tsx: @/components/EditScreenInfo could not be found within the project or in these directories: node_modules 1 | import { StyleSheet } from 'react-native'; 2 |
3 | import EditScreenInfo from '@/components/EditScreenInfo'; | ^ 4 | import { Text, View } from '@/components/Themed'; 5 | 6 | export default function TabTwoScreen() {. Error: Unable to resolve module @/components/EditScreenInfo from /media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/app/(tabs)/two.tsx: @/components/EditScreenInfo could not be found within the project or in these directories: node_modules 1 | import { StyleSheet } from 'react-native'; 2 | 3 | import EditScreenInfo from '@/components/EditScreenInfo'; | ^ 4 | import { Text, View } from '@/components/Themed'; 5 | 6 | export default function TabTwoScreen() { at ModuleResolver.resolveDependency (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:139:15) at DependencyGraph.resolveDependency (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/node-haste/DependencyGraph.js:277:43) at Object.resolve (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/lib/transformHelpers.js:169:21) at Graph._resolveDependencies (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/DeltaBundler/Graph.js:473:35) at Graph._processModule (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/DeltaBundler/Graph.js:261:38) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Graph._addDependency (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/DeltaBundler/Graph.js:372:20) at async Promise.all (index 2) at async Graph._processModule (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/DeltaBundler/Graph.js:322:5) at async Graph._addDependency (/media/martinb/SSD1TB/dev/Proyectos-Full-Stack/react-native-code-push-expo-plugin-managed-workflow/node_modules/metro/src/DeltaBundler/Graph.js:372:20) info Run CLI with --verbose flag for more details. Error: Failed to release a CodePush update.
I have not tried to get this working with a managed workflow myself as that is not my need. Personally, I feel like if you are doing a managed workflow you should probably consider using Expo EAS instead of Codepush. Otherwise you will probably have to wait until CodePush supports Expo managed more directly. Which may never happen.
There might be a way to get it to work, but that's not something I'm able to look into and it seems like you've already done some good digging yourself and are coming here because of the road blocks you are finding that probably will not be easy to solve.
Hi @deggertsen! I can confirm that your plugin works with managed workflow on Expo dev clients. I have created a fork of your repo, also I have updated the plugin code in your repo and created a PR.
This is tested and working in my test repo https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow
I'm updating the repo readme with detailed instructions on how to use your plugin for folks that use Expo dev clients.
Hi @sharvilak11 I confirm that it does work, demo repo here https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow with plenty of documentation to get it up and running
This is great! I have approved and merged your PR. I didn't see anything wrong with it and it adds some features that are certainly valuable.
Thanks for your contribution!
Hi. First of all, thank you for this great plugin. Could you please let us know if it's possible to integrate this with expo managed workflow ?
We have a codebase where we ship 70 apps with different branding via app.config.js and eas-update only allows 20,000 OTA updates. We would like to switch to code push to increase OTA count and avoid paying extra money.