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.
Join the DZone community and get the full member experience.Join For Free
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
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
Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.