electrode-io / electrode-native

A platform to ease integration&delivery of React Native apps in existing mobile applications
https://native.electrode.io
Other
723 stars 113 forks source link

[Add mini apps] Is there a way to add a mini app hosted on Azure DevOps Repo #1505

Open Castafiore opened 4 years ago

Castafiore commented 4 years ago

I have a mini app hosted on Azure DevOps Repo, when I try adding it with ern cauldron add miniapps <path_of_miniapp_hosted_on_Azure_DevOps_Repo>, i got error below ✖ An error occurred: Missing version for git+ssh://git@pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp, @belemaire could you tell me is it possible to add such a mini app?

belemaire commented 4 years ago

Hi @Castafiore Could you try adding the git branch to the path of the miniapp ? The error message is not super clear, we will improve it, but basically for any miniapp you add to a cauldron it needs a version for the miniapp. For git based miniapps this can either be in the form of branch, a tag or sha. If master is your main branch could you retry for example by running ern cauldron add miniapps git+ssh://git@pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp#master

Castafiore commented 4 years ago

Hi @belemaire Thanks for your reply. Azure DevOps Repo has a different repo ssh url schema (pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp for my repo) and branch schema (?version=GB) from github (whose ssh url starts with git@). Actually I've tried cauldron add miniapps git+ssh://git@pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp?version=GBv0.0.1 but get error ✖ An error occurred: Missing version for git+ssh://git@pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp?version=GBv 0.0.1 then tried cauldron add miniapps git+ssh://pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp?version=GBv0.0.1, but still get error ✖ An error occurred: Missing version for git+ssh://pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp?version=GBv0.0. 1. I think the cauldron add miniapps git+ssh://pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniapp?version=GBv0.0.1 should be correct, but I don't know why still telling me missing version coz I have set version on package.json. So could you tell me adding miniapp through git repo url only supports github repo or supports also Azure DevOps repo? If Azure DevOps repo is supported too, how to configure the command in order to add miniapps hosted on Azure DevOps repo? Thanks in advance.

BTW one more question? According to official docs, we can integrate a miniapp into a native mobile app written directly in Java (for Android), Obj-C and Swfit (for iOS)and launch the miniapp whenever inside the native mobile app, but is it possible to integrate a miniapp into a react native mobile app (written directly in JS)and launch the miniapp whenever inside the react native mobile app? I just tried, and I can integrate a miniapp into my react native mobile app and launch it immediately when react native mobile app is launched, but I don't know how to launch a miniapp when user interaction (E.g. launch a mini app after a user clicks on a button on react native mobile app).

Castafiore commented 4 years ago

Hi @belemaire Could you please answer my questions on my previous comment if you have time?

belemaire commented 4 years ago

@Castafiore

Could you try using this

git+ssh://git@pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniap#GBv0.0.1

Assuming GBv0.0.1 is a proper git tag or branch in your repository. The format you are using with ? is not a supported format for git dependencies url. Internally we are just running yarn add [dependency] which accept the same format for dependency as npm install. Valid format for dependencies coming from git is documented on npm website. This is not electrode native specific.

That being said I tried to create a git repo in Azure devops to try it out end to end and noticed another issue that I'll have a look into.

Regarding your second question, it is not really possible to integrate miniapps into existing react native applications. miniapps are combined together and shipped in a container which is a native library containing the JS bundle of the miniapps + all native dependencies, including react-native itself and integrates into the native app. You'll run into some complex things and conflicts if you try to put an Electrode Native container inside a react native app as react-native library will be included twice and potentially initialized twice (in the pure RN native app but also in the container) not mentioning other native dependencies such as native modules. Electrode Native can be used to ship RN miniapps into a pure non RN native app. If you already have a RN mobile app and what to use ern, you should convert the existing RN mobile app into a MiniApp (basically getting rid of android/ios directories and extract only the JS RN code of this app) as a first step.

Castafiore commented 4 years ago

@belemaire Thanks for your reply.

  1. For ern cauldron add miniapps <path>, I do have tried git+ssh://git@pwc-us-emtech-lab.visualstudio.com/Lab%20App/_git/lab-hello-world-miniap#GBv0.0.1 and got error :

    ✖ [syncCauldronContainer] An error occurred: Error: ssh: connect to host pwc-us-emtech-lab.visualstudio.com 
    port 22: No route to host
    ✖ fatal: Could not read from remote repository.
    ✖ 
    ✖ Please make sure you have the correct access rights
    ✖ and the repository exists.
    ✖ 
    ✖ An error occurred: ssh: connect to host pwc-us-emtech-lab.visualstudio.com port 22: No route to host
    ✖ fatal: Could not read from remote repository.
    ✖ 
    ✖ Please make sure you have the correct access rights
    ✖ and the repository exists.

    but I have set ssh key and I can push / pull code from my azure devops repo via ssh. I have read the dependencies docs on npm website, but I don't get useful info. So I think what I can do is moving my repo to github, but hopefully it can be resolved in future.

  2. For native app, I will use pure native mobile app. Thanks so much!

belemaire commented 4 years ago

Yes I've noticed similar issue ... I'll have a closer look tomorrow and try to come up with a fix, I'll keep you posted.

Castafiore commented 4 years ago

@belemaire Thank you so much on it :)