Introduction to the BlackBerry WebWorks CLI

HTML5 / 11.28.13 / donnyhalliwell

Editor’s note: below is a blog post from Bryan Higgins from the WebWorks team. @bryanhiggins on Twitter

The BlackBerry WebWorks SDK v2.0 introduces a new command line interface designed to help you complete tasks with ease.

If you’re already familiar with Apache Cordova or PhoneGap CLI, you will find the commands nearly identical. If you’re new to Cordova or just want a refresher, read on for a full tutorial. You might be surprised at how easy it is to use.

Screen Shot 2013-11-28 at 11.28.12 AM

The first thing you’ll need to do is create a project. In the past, you had to manually create a folder with a config.xml file and web assets. This is now done automatically by the create command. Simply provide it a path along with an id and name for your app.

Screen Shot 2013-11-28 at 11.29.25 AM

A few different folders are created for you, but usually you’ll be most interested in www. This is where the HTML, JavaScript and CSS for your app belong, along with the config.xml file. See here for more information on the project structure.

Screen Shot 2013-11-28 at 11.29.58 AM

In most cases, you will want to access some of the device APIs. In WebWorks 2.0, not only can you access the full set of BB10 APIs, but also all of the Apache Cordova core plugins and many others developed by third parties.

The plugin command allows you to add, remove and list the plugins for your app.

Screen Shot 2013-11-28 at 11.31.13 AM

The next thing you’ll likely want to do is test your app on a simulator or a device. If you go the simulator route, follow these instructions to get a BB10 simulator up and running, then use the emulate command.

Screen Shot 2013-11-28 at 11.32.25 AM

To test on a device, use the run command. You no longer need to remember the IP address or manually generate a debug token. Make sure your machine is set up for signing and use the run command. You will be prompted for your device and keystore passwords.

Screen Shot 2013-11-28 at 11.33.16 AM

Once you’re happy with your app, it’s time to post it to BlackBerry World. You will need to use the build command to generate a signed BAR file. See this page for more information on signing your app.

Screen Shot 2013-11-28 at 11.34.21 AM

And there you have it – just a few simple commands to create, debug and package your app for distribution!

There are some additional commands and options available for more advanced scenarios. See here for full documentation of the WebWorks CLI.

Our usual channels are standing by to process your feedback on the new framework and tools we are delivering in this Beta, so we can ensure the Gold release is rock solid. Contact us in the forums, in the public issue tracker, and on Twitter at @BlackBerryDev.

About donnyhalliwell