I’d like to preface this post by saying that I’ve upgraded Cordova CLI 5-6 times on one project, but haven’t upgraded after submitting to any marketplace (the app store, etc) or after using plugins. I have, however, done some customization of the app.
Like I mentioned before, Cordova CLI is a moving target. So, you should be prepared to deal with upgrading your toolset. There are two types of updates–minor and major. Major will require more testing since APIs could change.
Just a heads up that 2.9.x is the last stable release of the 2.x codebase and the team has promised to support it for a long time (but not with new features). I have no idea how hard it will be to move a app from 2.9.x to 3.0.x, but I imagine there will be many plugins that won’t move to the new architecture, so I expect 2.9.x to be around for quite a while.
You can see if there is a new release of Cordova CLI by running
npm outdated -g cordova.
To update either kind of release major release:
- Make sure that all your code is checked in (you are using version control, right)
- Move your old project directory to
- Move your
- Checkout your project directory from your version control system
npm update -g firstname.lastname@example.org
- Check out your project from source control
mkdir platforms; mkdir plugins
cordova platforms add [your platforms]
cordova plugins add [your plugins]
- continue development
This illustrates why it is so important to keep everything in version control. Because Cordova CLI controls the platforms and plugins directories, you have no idea what is happening in there, so any code or configuration that is in there should not be customized. For one thing, when you change versions of cordova, the cordova.js file that lives under platforms may or may not be changed–that’s why we re-add the platforms.
In my next post, I will discuss what hooks are.