Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

code share between web app and cordova app

We have written an angularjs web site/app - optimised for mobile
and are using cordova to make an html5 based mobile app.

The code (html, css, js) will be the same for both the web app and cordova app
but there will be some files that will be different.

How do we set up our git repo to share (only) common files between the web-app repos and the cordova-app repos ?

Obviously any .gitignore files are tracked and are common to all repos. We could add all files we don't want in the cordova repo to .gitignore but that will reduce the usability of 3+ web app repos for the one cordova repo.

We've tried:

  1. Having a local repo of the project for the cordova app with .git/info/excludes on that repo instead of .gitignore files - but this only solves the problem for pushes from that repo, not pulls from the origin (which will cause errors with untracked files)

  2. Setting up a different branch - and use a git flow style approach for intermediate branch for merges - but it's (apparently) not possible to have an .git/info/excludes specific to a branch - so everything will get overwritten on each merge

like image 615
goredwards Avatar asked Apr 12 '15 03:04

goredwards


1 Answers

I would need more informations about the project because it could depend of a variety of factors: goals, time, budget, etc... But in my opinion there are much more differences than only "some files" between a web and mobile projects. For example:

  • a mobile hybrid app need some plugins to do some specific mobile tasks and behave as a mobile app
  • a well optimized web app could be too heavy for a mobile app
  • web app need support also IE but a mobile app not
  • a good responsive web app interface is not a mobile interface and vice versa

For this I would create three separate repositories: an AngularJS Web project and an Ionic Mobile project. And the third repo with an AngularJS module that will be imported as a git submodule. This third module could be as a Core module with all functionalities (services, directives, filters and so on) that will be shared between the two applications.

like image 95
manzapanza Avatar answered Oct 05 '22 14:10

manzapanza