Over a million developers have joined DZone.

Checking for Platform and Plugin Updates in Your Cordova Project

Cordova recently released a big update for iOS, Apache Cordova iOS 3.9.2. Here's your guide to checking for plugin and platform updates.

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

Earlier today the Cordova team announced an important update for the iOS platform (Apache Cordova iOS 3.9.2). I thought it might be worthwhile to discuss how you can check your platforms and plugins for updates. It isn’t a complex process, but it is probably something to make part of your routine management in your organization. As I don’t manage one application but build lots of silly demos, I don’t necessarily have to worry so much about this. Despite that, I was curious so I did a bit of digging.

Let’s discuss platforms first. In a Cordova project, you can type cordova platforms to get a list of installed and available plugins. Here is an example:


Notice how at the end of each installed platform the current version is printed. Cool. But given that you aren’t following the Cordova blog, how would you know a newer version of the iOS platform existed?

Shaz (from the Cordova team) pointed out that the CLI supports a “check” command – this was something I had missed! According to the CLI docs, running cordova platform check will “list platforms which can be updated by `cordova platform update`”.

Cool. Unfortunately, in my testing, it was pretty broken. I tested against three or four projects and only once did it see an update and it never reported that my iOS platform could be updated. From what I can tell with conversations with Shaz and others, this feature hasn’t been properly tested yet so it needs some work. However, if you are reading this in the future, try this first as it is the most direct way of reporting on your platforms. If your curious about the bugs I reported, you can find them here: CB-9951 and CB-9953.

The alternative for now is to use npm. The platform code all exists on npm and all you need to do is figure out the package name of the platform itself. This is rather easy to guess for iOS and Android:


If you choose to update, you can simply cordova platform update ios and if you decide you made a huge mistake, you can install an earlier version by doing cordova platform update ios@X where X is a version. To be honest, in the past I’ve also remove and re-added a platform. That’s silly, but I’ve done it.

So – what about plugins? Running cordova plugin ls will report on installed plugins and their versions:


Unfortunately, there is no “check” command like we have with platforms (broken or not), so you’ll need to use npm info again to see if new versions exist:


There is no upgrade command either, but you can rm and add a plugin in a few seconds so just do that and you’re set.

But wait! There’s more. Don’t forget your CLI also has a version. It is easy to check both your version and the latest release:


So now that you’ve chewed on that a bit – let’s hear from Steven Gill, also from the Cordova project:

Btw, the plan is to move towards stop advising users to update platforms independently (except patch releases like this one). Instead we will only tell users to update cli and add a command (cordova update) that would update necessary platforms and plugins based on new pinned versions in cordova-lib. (Plugins will start to be pinned soon). That way we can verify the mix of plugins, platforms and tools have been tested together.

So my translation is – it’s going to get simpler. That’s good great.

The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.


Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}