The Electode React Native Workflow
Electrode React Native encapsulate a set of tools to streamline a complete mobile production line, from the development of MiniApps in React Native using JavasScript, to their actual delivery and integration in existing mobile application(s).
Any typical production line involves different types of "workers"/"actors", acting at different steps on the line, each having their own role and expertise.
In that sense, Electrode React Native is no different; and depending of the hat you're wearing, you will interact with a limited surface of the platform (i.e only use a few commands of the CLI).
From a bird's eye view, we can identify three high level "stages" in the Electrode React Native workflow, from start to finish. Each stage comes with its specific workflow items, as we will see.
Also, to each of the following stages we associate specific actors that should only have to deal with this specific stage.
That being said, this is just to give you an idea; this is not black and white; dependening on the size of your organization/team, and/or how you want to accomodate to your needs the Electrode React Native workflow, actors might deal with mutliple stages, or overlap on different stages.
Stage 1 - MiniApps development [JavaScript React Native developers]
Everything starts with one or more MiniApp(s).
MiniApps will typically be developed by JavaScript developers, having some experience (or looking towards gaining experience) on front end applications written in JavaScript, using React or React Native.
Seasoned React Native developers wont't actually feel much difference compared to their already known workflow for to the development of React Native applications. Indeed, as we will see, the workflow is pretty similar to the one offered by React Native, and most of the commands involved are the equivalent of some React Native commands.
This stage mostly involves the following workflow items :
Creating a new
MiniAppproject throughern create-miniappcommand (equivalent ofreact-native init)Adding needed JavaScript and/or native dependencies (platform APIs or supported third party native modules) to the
MiniAppusingern addcommand. (equivalent ofyarn addornpm install)Launching the
MiniAppon its own, inside the platformRunnermobile application, in order to develop/debug and test theMiniAppstandalone, usingern run-androidand/orern run-ioscommands (equivalent ofreact-native run-android/react-native run-ios)And of course, actually working on the implementation of the
MiniAppitself, though this is not a platform specific workflow item
If you are a MiniApp developer who just wants to open source a MiniApp to be used by any mobile application using Electrode React Native, this will probably be the only commands you'll have to deal with. If you want maximum reach for your MiniApp, you should also make sure to update the versions of the native dependencies it uses to align with the ones declared in our master Mnaifest upon every release of the platform (every 2 weeks). If your MiniApp is popular, the open source community might even do that for you ;) This can easily be achieved through ern upgrade command.
All you are left with is publish your MiniApp version, and every update of it to npm, and let mobile applications use it.
However, if you are creating MiniApps to be added only to a single target mobile application, or a very limited set of mobile applications (for example if you are creating non open sourced MiniApps to be only used for your company mobile application(s)), your workflow might involve more items, respectively :
- Launching/Debugging/Testing your
MiniAppwithin the target mobile application(s) and not on its own in the platformRunner. It means that yourMiniAppwill probably co-exist with some other ones in the same mobile application. In that context, you will interact with theern link/ern unlinkandern startcommands to help you arround this use case.
Stage 2. Adding/Updating MiniApps to/in a mobile application [Release managers / Mobile application leads]
This is the stage where you will hand pick the MiniApp(s) you wish to add to your moible application, and also deal with adding newer versions of those (i.e updating).
Dependending on your organizational structure or desires, this stage might be handled by a dedicated release manager or mobile application lead, but it could also be handled by MiniApps developers themselves. This stage also includes shipping new versions of MiniApp(s) through over the air updates (CodePush).
THis is where most of the dependency versioning control aspect of the platform takes place, and where the Cauldron, Manifest and Container Generator are working hand in hand. This stage mostly involves interacting with Cauldron commands.
It encompass the following workflow items :
Creating new native application versions in the
Cauldron
Throughern cauldron add nativeappcommand
You will have to do this for each new mobile application version for which development is getting startedAdding/Removing/Updating
MiniAppsfor a targets in-dev mobile application versions Throughern cauldron add/del/update miniappscommandsAdding/Removing/Updating
native dependenciesfor target in-dev mobile application versions
Throughern cauldron add/del/update dependenciescommands.
Please note however that native dependencies thatMiniAppsdirectly depends upon, will be automatically added to the container when adding or updating aMiiniAppversion to a given mobile application version.
This workflow item is therefore limited only to native dependencies that noMiniAppsare actually depending upon (mostly only to add standalone nativeAPI implementations).Updating the release status of mobile application versions Through
ern cauldron update nativeappcommand.
Flagging a mobile application version as being released, will actually 'freeze' the mobile application version, to disallow any new changes to the native dependencies (you cannot update native code over the air). It will activateCodePushfor this mobile application version, allowing you to effectively push JS changes ofMiniAppsas over the air updates.Adding or updating
MiniAppsthrough over the air CodePush updates Throughern code-pushcommand.
Stage 3. Integrating MiniApps in a mobile application [Mobile application developers]
This is actually the only stage that does not require use of the platform CLI at all.
Mobile developers do not actually have to install any JavaScript tools, nor the platfom itself.
Indeed, all they will interact with is the Container library itself, which is shipped as an AAR for Android, and an Umbrella Framework for iOS.
The Container contains everything that is needed to actually launch and interact with the different MiniApps part of it. In addition to the MiniApps themselves (stored in a composite single JS bundle), the container contains all the native dependencies needed by the MiniApps (including react-native itself of course), as well as the assets of the MiniApps (images and fonts mostly) and initialization code to call from your mobile application to initialize the Container and get access to the MiniApps within.
The most demanding part of this stage has actually to be done only once. This is when you'll first add a dependency to your Container library in your mobile application and add the required code to properly initialize the container.
Once this step is done, you'll be mostly left with bumping the Container version every time it gets regenerated (i.e any time a new MiniApp makes its way in it, or gets removed or updated). And also of course, taking care of the native code to actually launch the MiniApps when needed in your mobile application flow, as well as potentially implementing APIs in the mobile application itself (this is not the recommended way for implementing native APIs, but might be neceserray in some use cases).
Bonus Stage. APIs generation and implementation [JavaScript React Native developpers / Mobile application developers]
This stage is actually kind of similar to the first one (creating MiniApps) but it can be performed either by JavaScript React Native developers or Mobile application developers dependending mostly on if the implementation of the API is done on the native side or the JavaScript side.
APIs facililates interaction/communication between your MiniApp(s) and your Mobile Application. From the point of view of a MiniApp, a natively implemented API can be consummed to access data or functionality exposed from the native side or trigger actions on the native side. From the point of view of a Mobile Application (or another MiniApp), a JavaScript implemented API can be consumed to access data or functionality exposed from the JavasScript side, or trigger actions on the JavaScript side.
This stage involves the following workflow items :
Creating (generating) a new
API
This can be achieved throughern create-apicommand
It will generate the complete JS/Android/iOS client surface code of the API, along with optional models. All you are left with is publishing theAPIversion on npm.APIcode itself should not be modified. The implementation of theAPIis kept separate, and is the code you actually will need to do on your own. We keep implementation separate from theAPIitself to allow for multiple different implementations of it, that can be easily switched dependending of your context (maybe mock vs prod).Updating (re-generating) an existing
API
This can be achieved throughern regen-apicommand
It should be done it you are adding new requests/events or models to your existingAPI. All you have to do is update theSwaggerschema accordingly and invoke the command. You can then publish this new version of theAPIto npm.Implementing an
API
An API without an actual implementation is like a bird without wings.
BecauseAPIgeneration and implementation are decoupled, the person in charge of theAPIgeneration might not be the one actually doing its implementation (even though this should be mostly the case). You can kickstart anAPIimplementation project throughern create-api-implcommand. Once done, all you are left with is actually coding to implement theAPIfunctionality, either as a native implementation (which can then be consumed by anyMiniAppdependening on thisAPI) or as a JavaScript implementation (which can then be consumed by anyMiniApporMobile Applicationdependening on thisAPI). Implementations can be standalone (i.e not bound to a specific mobile application or MiniApp), which is the recommanded approach, or can be directly done in the mobile application or MiniApp itself.