Ionic App Folder Structure & Git submodules

Hello All,

I wanted to see if the fine experts on the forum had any advice on where to put Git submodules into a project’s folder structure. It’s probably going to be a case of “it depends”, though I wanted to see if anyone had any hard earned lessons to share. I currently have a set of code I want to break out into a separate repository for use in other apps (including the one I am taking it out of). It is currently under src/app/… I was planning on creating the new repo, push it to remote, remove the code from the primary project and add it back in as a submodule (and of course add it to other apps in the future).

My question is more of a best practice one, I guess. Where would you place the submodule within your project and why? What are some of the considerations for a scenario like this?

Thanks,

Robb

1 Like

Hi,

We are facing the same issue at the moment. We already have multiple Ionic2/3 Apps which all have common components but live on their own repositories. All of our apps for example have the same login page and make use of the same themes, config section and each app is connecting to the same backend (so we have a common http service). Our production environment is written in Smalltalk / Seaside and is accessible via the browser - therefor we are developing mobile apps using Ionic for very special use-cases where an app is more suitable than writing the features in our production environment. Some of the apps we can reuse just for different customers (only changing brand pictures) some of the apps are slightly different but have a lot in common, some live on their own.

At the moment if something changes on our production environment we have to change the code in every app and make a new release which is getting very annoying.

As robb already asked is there any best practice on how to share / develop / embed shared modules in Ionic 3? I have read a lot about using submodules / subtrees but I am not sure which one to use.

So my questions regarding using shared modules / shared code over multiple apps are:

  • Is there anything planned by the ionic team - maybe something using the CLI

  • Is someone already using git submodules or subtrees and can give some advice

  • Is there any other approach (npm - typescript - grunt …)?

Thanks,
Bernd