Cordova 5.0.0: What files should I execute for git?

I am using Cordova 5.0.0 and I have the following project structure:

MyProject - hooks - platforms - plugins - resources - www - config.xml 

Now my question is: which of these folders can I omit? I ask about this because I work on three different platforms. I am developing Linux for Android, Windows for Windows Phone and Mac for ios. If I complete the entire project, I always get warnings and errors for unsupported platforms.

What I want is a minimalist git repository.

One of the problems, for example, are plugins. When I delete the plugin folder from the repository, I have to add them to each of my development platforms manually.

Another problem is the resource folder. I automatically create icons and pop-up screens using ionic. When I try to create a project on ios, it complains about images for Android.

So what do I need and what can I omit?

+74
gitignore cordova
Apr 30 '15 at 2:48
source share
8 answers

You can ignore the directories of platforms and plugins if you have not added any custom code to them.

When adding plugins and platforms, add the --save command to the command. eg.

 cordova platform add ios@3.8.0 --save 

or

 cordova plugin add cordova-plugin-device --save 

This will keep a record of the plugins and platforms that you use in the config.xml file. When you run cordova prepare or cordova build , all of your plugins and platforms listed in the config.xml file will be installed if they were not already.

You can also specify the platform during preparation and assembly. Therefore, if you are on your Mac, you can check the git repository and run cordova prepare ios to install only the iOS platform and plugins.

+111
Apr 30 '15 at 16:16
source share

It depends on the platforms.

You can use this .gitignore example and customize according to your needs.

 # Mac .DS_Store # iOS platforms/ios/build/ platforms/ios/www/ platforms/ios/cordova/console.log *.xcuserdatad # android platforms/android/assets/www platforms/android/bin platforms/android/gen platforms/android/local.properties platforms/android/ant-build platforms/android/ant-gen platforms/android/CordovaLib/ant-build platforms/android/CordovaLib/ant-gen platforms/android/CordovaLib/bin platforms/android/CordovaLib/gen platforms/android/CordovaLib/local.properties # wp8 platforms/wp8/bin platforms/wp8/obj platforms/wp8/www platforms/wp8/.staging platforms/wp8/*.suo platforms/wp8/*.csproj.user # res resources/signing 
+39
Apr 30 '15 at 15:25
source share

After that, you can save the platform and the plugin using the following commands.

platform memory saving

 $ cordova platform save 

Saving plugins

 $ cordova plugin save 

Note that in the <- strong> commands

no -

One more thing: after receiving the repo on another machine, you run the following command to automatically create and receive plugins and platforms.

 $ cordova prepare 

See the links below for more details. https://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/#mass-saving-platforms-on-an-existing-project

Council of Cordoba . Always refer to white papers before doing anything else to get the right solution.

+16
May 12 '16 at 4:13
source share

I do not know the answer, but I found something that could help. This request has been approved .

Here is the file :

 # Mac .DS_Store # Node npm-debug.log /node_modules # Cordova /platforms /plugins # res resources/signing 
+14
Feb 16 '18 at 15:16
source share

I have completed the following steps:

  • create cordova project

  • add platform

  • add plugins

Before creating a project, I commit and click the generated files. After I create the project and check the creation of new files. I added them to .gitignore:

/platforms/android/gradlew.bat

/ platforms / android / build

/ platforms / Android / gradle

/ platforms / Android / LIBS

/platforms/android/gradlew.bat

/ platforms / Android / CordovaLib / builds

/platforms/android/.gradle

+3
Mar 09 '17 at 5:36 on
source share

Most other answers are 2/3 years old.

2019 Update:

 # remove extension less files * !/**/ !*.* # intermediate files node_modules/ build/ obj/ Debug/ bin/ package-lock.json .vs .gradle .idea *.exe # res **/resources/signing # project specific **/dist/ **/all.min.js # ========== Cordova - platforms # android # platforms/android/app/src/main/assets # platforms/android/app/src/main/AndroidManifest.xml # platforms/android/app/src/main/res/drawable-* # platforms/android/app/src/main/res/mipmap-* # platforms/android/app/src/main/res/xml/config.xml # browser # platforms/browser/app/src/main/assets # platforms/browser/config.xml # platforms/browser/www # # ========== Cordova - plugins - remove all except json & xml # plugins/**/.DS_Store # plugins/**/*.cs # plugins/**/*.h # plugins/**/*.java # plugins/**/*.js # plugins/**/*.m # plugins/**/*.map # plugins/**/*.md # plugins/**/*.modulemap # plugins/**/*.ts # plugins/**/LICENSE # plugins/**/NOTICE # plugins/**/*.gradle # plugins/**/tests/ 

As you can see, I commented on most of the lines (all lines begin with C #). This is due to the fact that I had problems with changing the plugin version, and I decided to find out what happens with the plugin updates. In fact, all platform and plugin files are included in the commit, now my life is calm.

2019:
I stated with that .

After the development and publication of the application, it became lower:
(If you deviate from the bottom, comment below, we can learn from each other)

 # remove extension less files * !/**/ !*.* # intermediate files node_modules/ build/ obj/ Debug/ bin/ package-lock.json .vs .gradle .idea *.exe # Cordova - platforms platforms # Cordova - plugins - remove all except json & xml plugins/**/.DS_Store plugins/**/*.cs plugins/**/*.h plugins/**/*.java plugins/**/*.js plugins/**/*.m plugins/**/*.map plugins/**/*.md plugins/**/*.modulemap plugins/**/*.ts plugins/**/LICENSE plugins/**/NOTICE plugins/**/*.gradle plugins/**/tests/ # res **/resources/signing # project specific **/dist/ **/all.min.js 
+2
Mar 03 '19 at 21:42
source share

I add to the list of Niko:

 # IntelliJ IDEA files *.iml .idea #windows Thumbs.db Desktop.ini 

and

 *.sw[mnpcod] *.log *.tmp *.tmp.* log.txt 
0
15 Oct. '15 at 15:41
source share

try this site, look for cordova https://www.gitignore.io/

0
Dec 13 '18 at 8:55
source share



All Articles