Share code between web application and cordova application

We have created an angularjs website / application optimized for mobile devices and use the cord to create an html5-based mobile application.

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

How to set up our git repository to share (only) shared files between web application repositories and cordova-app repositories?

Obviously, any .gitignore files .gitignore tracked and shared by all repositories. We could add all the files that we donโ€™t want in the cordova report to .gitignore , but this will reduce the usability of 3+ web applications for one repo channel.

We tried:

  • Having a local project repo for the cordova application with .git/info/excludes on this repo instead of .gitignore files, but this solves the problem only to pop out of this repo, and not pull from the beginning (which will lead to errors with unprepared files)

  • Setting up another branch - and use the git thread style for the intermediate branch for merges - but it is (apparently) impossible to have a branch specific .git/info/excludes - so everything will be overwritten with each merge

+6
source share
1 answer

I need more information about the project, because it can depend on many factors: goals, time, budget, etc. But, in my opinion, there are much more differences than just โ€œsome filesโ€ between the network and mobile projects. For instance:

  • A mobile hybrid application needs some plugins to perform some specific mobile tasks and behave as a mobile application.
  • A well-optimized web application may be too heavy for a mobile application.
  • the web application needs support also IE, but the mobile application does not
  • a good responsive web application interface is not a mobile interface and vice versa

To do this, I would create three separate repositories: AngularJS Web project and Ionic Mobile project . And the third repo with the AngularJS module to be imported as a git submodule . This third module can be as the main module with all the functionalities (services, directives, filters, etc.), which will be shared between two applications.

+3
source

Source: https://habr.com/ru/post/985007/


All Articles