Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating cordova plugins according to config.xml

I work on my cordova project on two machines: macbook and a PC. When I update plugin on one machine, nothing updates on another after pulling changes. Tracking cordova plugins with git would fix the problem, but it looks really bad. Currently I'm tracking config.xml only.

When I try to execute: cordova plugin add cordova-plugin-my-plugin it only shows list like this:

...
skipping existing file: android-1.png
skipping existing file: android-2.png
cp: dest file already exists: /Users/user/cordova-app/plugins/cordova-plugin-my-plugin/LICENSE
cp: dest file already exists: /Users/user/cordova-app/plugins/cordova-plugin-my-plugin/README.md
...

So it ends up with a donkey work for every plugin:

  • cordova plugin rm cordova-plugin-my-plugin
  • cordova plugin add [email protected]

Does anyone had and solved this problem?

like image 732
Cezary Daniel Nowak Avatar asked Jan 28 '26 13:01

Cezary Daniel Nowak


1 Answers

Use cordova plugin add [email protected] --save - this will put the plugin npm name (or local path, or url) along with version into the config.xml.
And then cordova prepare will restore the plugin at the saved version.

See https://cordova.apache.org/docs/en/6.x/platform_plugin_versioning_ref/index.html#saving-plugins for details.

like image 149
daserge Avatar answered Jan 30 '26 04:01

daserge