Two Apps, little difference?


#1

Hi all,

I recently started working with Ionic and Cordova, as my job requires me to, and I come across an issue that serves as a bottleneck.

Right now, we’re developing essentially two apps that’re based off of just one business model or majority of code. The first app is our main one, but the second one is for a specific customer. The differences are minimal, namely: theme changes (colour and logo) and two views that should be excluded, as they need to skip the entry point.

Preferably, we want to only use one code base and make the second app the ‘exception’ to the rule, by using something similar to view overrides in certain content management systems (such as Orchard CMS).

Right now, the folder structure is as follows:

  • Root
    — assets
    — app1
    ------ www
    ------ [etc.]
    — app2
    ------ www
    ------ [etc.]
    — node_modules
    — .bowerrc
    — [etc.]

Or rather: what would be the ideal way to solve this crux and how would I go on about this?

Any help would be greatly appreciated.


#2

I would hold the main app in a repository. another repo only for the changes for the special customer.

if you want to build/work with the special app --> add your own process like --> get the latest sources of the customer repo and replace the basic files (like theming and templates).

So you do not need to manage all files in one ionic project and hold duplicated code/files.


#3

@bengtler My apologies for the rather slow reply.

One thing I do not understand: what do you mean by “add your own process like”?

I very much appreciate the help and thanks for your swift reply!


#4

Hello,

You can use gulp to do it. You write two tasks, one for making the package for your main app and another task for the other app.

In your root you have the commons files, before building your app you can execute the gulp task to copy the file of the version needed and in some files just replace the string value (ex : app name).

Root
— assets
------ www
------ [etc.]
— app1
-----www
--------app1 specifics files
-----[etc.]
— app2
-----www
--------app2 specifics files
-----[etc.]


#5

Thanks for the very quick reply, @rberthome! I’ll definitely use that approach.

Cheers to the both of you! =D


#6

Glad I could help you out :slight_smile:

This is what I did in my app in order to build app in differents environments (DEV, PROD) and add other logics.