Alternatives to Cordova CLI

If you are interested in building Cordova applications, Cordova CLI has few competitors. The ones I know about:

  • Homegrown script: I built an ant script to do much of what Cordova CLI does–build packages, run tests, and start emulators. I’m sure you could use any other build tool to do the same. There’s some reverse engineering, and tangling with iOS build tools isn’t much fun.
  • Different code trees: use the Cordova create script to create a project for each platform, and then let the html, css, and javascript evolve differently for each, possibly relying on an IDE to do compilation/building. This may be a viable option if you have hard requirements that each platform’s build can be tested against, or if you don’t care to share code between platforms. Upgrading versions of Cordova may be an issue.

As you can see, there aren’t too many other options for doing Cordova development. If you are interested in forward compatibility, I suspect you’ll choose one of the scripting options (Cordova CLI or a homegrown script); if you just want to get the project done, I think you’d lean towards using an IDE after the project is created–it all depends on how future proof you want the app you are building to be.

In the next post, I will discuss installing Cordova CLI.

Subscribe to my infrequent Cordova newsletter


What is Cordova CLI?

I’m planning to write a number of posts documenting my adventures through the new Cordova (aka Phonegap, though there are differences) command line interface, known as Cordova CLI. I am in the midst of working on a Cordova application and have been using Cordova CLI heavily for a while now. My focus has been on the Android platform, though we plan to release to iOS as well, so that will be where the majority, if not all, of my examples are.

These posts only cover cordova cli 2.9. Cordova 3.0 is an overhaul that changes how the core Cordova app is assembled, and therefore has different constraints.

Here’s a list of what I plan to cover:

  • What is Cordova CLI
  • Alternatives to Cordova CLI
  • Installing And Using Cordova CLI
  • Placing Cordova CLI projects under version control
  • Upgrading projects managed with Cordova CLI
  • Hooks and Cordova CLI
  • Configuration management using Cordova CLI
  • Setting up CORS
  • Platform Specific CSS/Javascript with Cordova CLI
  • Platform specific configuration files with Cordova CLI
  • How to set up a new plugin for use with Cordova CLI
  • How to ‘plugman’ify an existing plugin
  • Releasing with Cordova CLI

Cordova CLI is different than the create scripts that have been part of Cordova/Phonegap (hereafter called Cordova for brevity) for a while (though it does use those create scripts). The create scripts only helped you create the project; afterwards you were on your own. Cordova CLI helps you create a project, manage css and javascript resources that differ per platform, develop and test it using both emulators and an in-browser emulator called ‘ripple’, manage plugin dependencies, and build packaged apps suitable for installation on phones and emulators during development. It is a nodejs application that runs on MacOS, Linux, and possibly Windows (see this bug).

Cordova CLI lets you keep the shared html, css, and javascript code in one place, and deploy it to multiple platforms. This is one of the main strengths of Cordova development–one set of logic deployed to multiple mobile platforms.

Be aware that Cordova CLI is early beta software. This is bad because you’ll run into issues; this is good because the software is under active development, and I’ve found the developers to be quite responsive to bug reports. I have occasionally filed a bug one day, and had a fix to download the next.

There are also areas where Cordova CLI has significant deficiencies–luckily they’ve built the software to be flexible enough you can work around it (or, if you can contribute fixes, they are happy to accept help). So, if you plan to use Cordova CLI, make sure you bookmark the issue tracker. Consider joining that jira and submitting bugs, but at the least search it when you run into an issue.

In the next post, I’ll discuss alternatives to Cordova CLI.

Subscribe to my infrequent Cordova newsletter




© Moore Consulting, 2003-2019