-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(react-native-code-push): add react-native-code-push plugin #204
Conversation
Love this! Thanks for building on this and getting it more out into the community. |
Thanks @deggertsen! By the way, I'm aware this might not fit monorepos. It just follows the Codepush docs line-by-line, which were mostly aimed at non-monorepo projects. The original (@deggertsen) PR had some code for node module resolution focused on solving this issue. However, there have been reports of production issues on Android with that code, making me not want to risk something I don't fully understand. I would appreciate a hand and eyes if we want to add monorepo support here, as it's the only thing I see that might be missing, but in all honesty, it follows the readme correctly and should help tons of people as-is already. Messing something up for not following the doc's instructions line-by-line isn't something I want to risk right now, as any mistake might affect tons of users. |
We're using this on a Monorepo ourselves with this plugin as a separate package. I think the main difference I'm seeing in the code in my monorepo is this line:
In my main expo package I have an app.plugin.js that points to the plugin package in the monorepo I feel like what you have here is a fantastic start. It will be easier to create PRs and suggest improvements once there is a baseline in place. So I don't feel like monorepo support is necessary out of the gate. |
Thanks, @deggertsen, I'm with you there. |
For anyone needing this plugin, I published this as an interim solution while this PR isn't merged: https://www.npmjs.com/package/react-native-code-push-plugin |
@GSTJ - wow this is awesome! My current production app utilizes codepush (bare RN as well) right now, and we have been refactoring the whole app to re platform and leverage how great Expo has become - and with EAS updates being integrated and a great option, my company still wants to go with codepush for OTA stuff. Is there plans for getting this merged / could I implement this in a production app? |
@mvolonnino I'm currently using this version I published under NPM as an interim solution on our project; it's working great for us on production. The app has 300k+ active users, so that's been battle-tested.
|
@GSTJ - wow thats amazing! Okay awesome, I am going to look into this this week and i'll let you guys know if I run into anything 👍 Thanks again for this, this is some amazing work and a big help to the rest of the community 🔥 |
@GSTJ - quick question, i've followed the plugin readme, but just want to double check, after setting everything up through the plugin readme, I can now integrate CodePush through their docs correct? Like wrapping the App, adding codepush options, etc?
Just double checking, as EAS is setup so its an eas build command, not expo prebuild, but the plugin will work all the same correct? |
@mvolonnino You can surely continue with their docs. The plugin only does the native changes for you. About prebuild, I recommend you run it. It will apply the plugin changes to your IOS and Android folders. You should be able to run the EAS build normally; yes. EAS build is likely running prebuild for you on the CI. |
@GSTJ - okay awesome! So just to make sure I understand you correctly, when i utilize the *edit - I see your edited post so I think that answered this follow up, but just double checking 🫡 |
@mvolonnino
If you don't commit them:
I recommend a read here https://docs.expo.dev/workflow/continuous-native-generation/ |
@GSTJ - sweet thank you for the article, will read up on CNG as well. Thank you again. Appreciate all your help on this |
Hi @brentvatne can you take a brief look at this, this is really cool if it can get through. Thanks! |
most of the expo team is out on holidays at the moment but we'll get back to you in the new year! |
Great! @brentvatne love you man, I really do! Happy holidays! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update this file as the MainApplication file is in kotlin now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have already updated and supported Expo 50 at:
https://github.com/gstj/react-native-code-push-plugin
https://www.npmjs.com/package/react-native-code-push-plugin
As I'm not seeing much moviment on the Expo Team side to merge this, I'm not maintaining this PR.
If the Expo Teams wants this, just let me know and I'll promptly update the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the link
Hopefully, Expo Team can see this and accept this. and hopefully expo team can add how to use codepush in expo router in their documentation. this is the solution i found on github using codepush and expo router: microsoft/react-native-code-push#2415 (comment) |
@glncy - codepush is being sunset by microsoft, so i don't think it makes sense for us to support this here. https://learn.microsoft.com/en-us/appcenter/distribution/codepush/ |
Hello @brentvatne I think CodePush will still work, but you will have to host it yourself on the server, because actually the App Center is scheduled for retirement. |
@LunatiqueCoder - it will kind of work yeah, but they do not intend to support the new architecture - so it's effectively dead in the water at this point since the new architecture is now default. |
@brentvatne Oh that's cool. I missed that. Should be easy to convince the customers to migrate to EAS Updates now. Thanks! |
Why
This PR adds Codepush support without requiring manual changes to the native code. It's based on the work started on this thread, which never got merged: microsoft/react-native-code-push#2415.
The community claimed this was broken on Android, so my work completely re-structured his work, ensured every step made sense, and followed the most up-to-date official Codepush documentation for both IOS and Android.
How
This evolved from a fork of @deggertsen's work at https://github.com/deggertsen/react-native-code-push-expo-plugin. The work here never got published on NPM and had some outstanding issues.
This is a rewrite, where I followed the newest Codepush Documentation step-by-step and updated every file accordingly to match. I also refactored and consolidated his work to make it easy to understand and follow through.
Shoutout to @deggertsen for his solid base structure.
Why not just merge it to Microsoft's repo?
@deggertsen has had a PR stuck on review since the beginning of the year, and there is a lot of bureaucracy in getting this code into CodePush's main repo.
Effectively, it isn't a repository made with this plugin in mind.
The idea here is to shine a light on the necessity of this plugin and battle-testing this approach with more users, and maybe we can get this merged into Codepush in the future.
@expo/config-plugins is community-maintained, so this fits better here for a head-start. I want to have this released on NPM sooner.
Test Plan
I've created a react-native-code-push folder on /apps, so this plugin can be more easily tested.
yarn
to install the projects dependenciesnpx expo prebuild