0.0.1 • Published 3 years ago

cultgear v0.0.1

Weekly downloads
12
License
ISC
Repository
github
Last release
3 years ago

Loki (Norse God)

From Neil Gaiman's Norse Mythology:

Loki is the God of disguises. He is plausible, convincing, like-able, and far and away the most wily, subtle and shrewd of the Asgard Gods. He can transform his shape so he looks like other people, or change into animal form, but his real weapon is his mind.

In that spirit, I present the CultGear mobile project. It takes many different forms: Android. iOS. Mobile web. PWA 🤞? This codebase also publishes a microapp SDK that can be embedded inside a React Native app.

Note: Check CONTRIBUTING to know how to make changes to and publish the SDK.

Building Blocks

  • React Native
  • React Native Web
  • Webpack / Metro

Setup

After cloning the repo, run

yarn

Development Setup

Microapp

Microapp source files are generated by running a bunch of transformations on the src directory. Read CONTRIBUTING to know how to make changes to and publish the SDK.

Development mode

During development, there is a need for getting immediate feedback for changes made to source files. Since microapp publishes to a package, it's not straightforward to make live debugging features available.

Manually, one can run yarn generate:microapp after making changes. This will make the updated code available under microapp/src, which can be copied over to any repo (e.g. curefit-mobile).

In order to provide faster feedback for one's changes, yarn watch:microapp can be run instead. This watches the source files and generates microapp source code. This in combination with an npm link (symlink) setup, can allow testing changes in other repos (e.g. curefit-mobile) in real-time.

Note
Since metro packager does not support sym-links, an alternative is to use wml utility. This in combination with yarn watch:microapp can be used to get updates from this repo to curefit-mobile as changes are made.

Following commands should come in handy for this setup:

wml add ./microapp/src ../curefit-mobile/app/micro
wml rm all
wml start

BEWARE: This setup spawns a bunch of watchers, and is likely to make your computer sound like the Hercules.

Android / iOS

Make sure Android SDKs / XCode / CocoaPods are installed properly, and run

react-native run-android

For iOS setup, run following commands:

cd ios/
pod install

And then run from the project root:

react-native run-ios

Web

IMPORTANT: Do not skip this step Add localhost alias

Add the following configuration to /etc/hosts file in order to run web locally:

127.0.0.1 dev.cultgear.com

To serve the web app, run:

yarn web

Web is now running at http://dev.cultgear.com:9000.

Release (Codepush)

Codepush collaborators can push a release with the following commands:

iOS:

code-push release-react Cultgear-Private-Limited/cultgear-ios ios \
--deploymentName {env} \
--targetBinaryVersion {appVersion}

Android:

code-push release-react Cultgear-Private-Limited/cultgear-android android \
--deploymentName {env} \
--targetBinaryVersion {appVersion}

Note: Replace the targetBinaryVersion and deploymentName parameters with the correct values.


Authors

Vividh Chandna vividh.chandna@cultgear.com

Shanawar Hasnain shanawar@curefit.com