2013-07-23-cordova-3.md 5.1 KB


layout: post author:

name: Brian LeRoux
url: https://twitter.com/brianleroux

title: "Apache Cordova 3.0" date: 2013-07-23 13:45:04 -5 categories: blog releases

tags: news releases MAJOR

It went live on Friday! Snapshot available on our download page but before downloading please read on to find out whats new including for more ways to work with Cordova!

Light Weight Core

Cordova 3 introduces a new unified project structure and ships with a very limited API surface. Developers can now compose a version of Cordova with only the APIs they need. In the past, Cordova shipped with the entire kitchen sink of APIs that most applications only needed a small subset of. This lead to messy, and often not even necessary, upgrading for our community. With the release of Cordova 3 you start with a very light weight core and only add the API surface your application requires. Obviously, this means a performance improvement but the real win here is maintenance and upgrading. We'll continue to maintain "core" APIs which are the same device APIs you've come to know and love.

New Command Line Tooling

We're very excited to share two new command line tools: Cordova and Plugman. Both are implemented using NodeJS and thusly distributed via npm. The cordova command line tool has been a long time coming. It unifies all platforms into a single project structure, making it easy to maintain a single codebase for multiple platforms. The cordova tool builds off of our other new tool: plugman, which provides automated discovery, installation, and removal of both core and custom plugins.

We've been testing for months but keep in mind both tools are new. Bugs happen, so you if you find one or even just have an idea for a new feature please visit our issue tracker.

Installing > Downloading

First, ensure you have NodeJS installed and then simply run npm install -g cordova. From here its a typical comand line utility. Get started by building an iOS app!

cordova create MyFunkyApp
cd MyFunkyApp
cordova platform add ios
cordova emulate ios

Cordova has to download platform files the first time create is run, so the first app you create might be a little slow. Just use the -d flag to see progress. For example, cordova -d platform add ios. Maybe crack a beer and chill while it goes about its business first run.

Now let's add Android, cordova platform add android. Yes: that easy!

Installing Plugins

If you are working with a platform project directly (one created through a Cordova platform's bin/create script instead of through the cordova tool), then plugman can be used standalone. Again, ensure you have NodeJS installed and then simply run npm install -g plugman.

cd MyFunkyApp
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git

You now have geolocation enabled your project!

If you are working with a native project directly then plugman can be used standalone. Again, ensure you have NodeJS installed and then simply run npm install -g plugman.

cd MyAndroidProject
plugman --platform android --project . --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git

Of course, you can create your own plugins! (And we're really excited to see what you do.) You can learn how to author a plugin by reading the plugin development guide. We are going to be writing much more documentation about this in the future. In the meantime, you can learn a great deal looking at the core plugins.

Upgrading

We have documented upgrading guides for each platform to help with the transition. Of course, do not hesitate to come for help in #cordova irc channel on freenode, or just visit our issue tracker.

Known Issues

Remember core plugins no longer exist by default in new projects and you have to manually add them using plugman or cordova. You know we release regularly so you can expect updates soon and we're going to leave a nice big window for deprecations as usual. Also remember this is an open source project so if something isn't to your liking you can always pitch in and fix it yourself!

  • Various native IDE's show generated files when using cordova-based projects. Be careful not to edit them or else you may lose your work when cordova is next run!
  • Whitelist (<access> tags) format is inconsistent across platforms
  • There is no "upgrade" command for cordova yet. You will need to remove and re-add plugins/platforms for now.
  • Not all platforms are supported by cordova. Currently only iOS, Android, BB10, and Windows Phone
  • A plugin discovery repository is still being baked and will be available very soon


Huge Thanks

Thank you to all the committers, testers, developers, and friends of Cordova whom made this possible!