Creating two apps with one codebase project


#1

Hi everyone !
I works for a company which has 2 apps on iOS that shared more than 70% of their code, so they have been created based on a single project with the xCode concept of targets (several apps generated from one codebase). Few weeks ago we planned to create the Android versions, and decided to move to Ionic (with the time-saving goal of also replacing the iOS apps by the webapps in the future).
But after days of studies on the framework, we didn’t manage to find a way to reproduce the xCode’s targets, so we “created” our own, by creating 2 versions of 3 elements of the project :

  • config.xml => config-A.xml & config-B.xml
  • www/index.html => www/index-A.html & www/index-B.html
  • resources/ => resources-A/ & resources-B/
    Each new element contains only datas needed by each target A & B (mainly in index-*.html which includes only the .js and .css needed), the original ones are added to .gitignore, the common .js are in a “shared” repertory, but only directives’ .html are shared for a matter of tidiness. So when we wants the app A, we only need to execute a very simple set of shell commands which removes the 3 original elements and renames the needed ones by removing the “-A” suffix, and so on with app B so we can instantly move from one to the other.
    But this isn’t a very clean way to do the job, it can have several limits with really big projects and it make we must adjust some things, when deploying with Jenkins for example.
    Of course the best way would be to add a functionnality in Ionic which make we can do “ionic run A” … but we actually neither have the time nor the skills to make this kind of things ! So I’m looking for advice of the Ionic community to know if it’s really a good way or do we have to fear for problems in the future, if there are better ways to do this, and if there are pending projects on this subjects in the dev community.
    Thanks by advance (sorry for my spelling mistakes, english is not my mother tongue !)