Reputation: 14726
I would like to not include the platforms and plugins in my git repository for my cordova project. Instead, I only include platforms/platforms.json
and plugins/fetch.json
. My .gitignore
looks like this
platforms/**
!platforms/platforms.json
plugins/**
!plugins/fetch.json
This ensures that only the two json files are tracked by git. This is my platforms.json
:
{
"ios": "3.9.1",
"android": "4.1.1"
}
However, I thought that a cordova prepare
would look into the platforms.json
and would install the proper version automatically for my project. The same would be very handy for the fetch.json
inside the plugins directory. However, I noticed that here no versions, git commit hashes... are tracked, it just looks like this:
"cordova-plugin-console": {
"source": {
"type": "registry",
"id": "cordova-plugin-console"
},
"is_top_level": true,
"variables": {}
}
So my questions are:
Upvotes: 2
Views: 1292
Reputation: 4148
I would say yes, so long as you set the versions of the platforms and plugins you want to use - keeping things that the CLI can generate out of source control is a good thing
Yes, you can use the @ notation for example:
cordova platform add [email protected]
This applies to platforms as well, and each version of the Cordova CLI defaults to a specific version of the Cordova platform unless you override it.
Regarding running a command, I use hooks for this and have a post platform add hook that runs a script that installs all my plugins using the @ notation to get exactly the version I want.
Upvotes: 2