-
Notifications
You must be signed in to change notification settings - Fork 13
phonegap cli
The PhoneGap Command-line Interface (CLI) is a command-line tool for Windows, OS X, and Linux. It allows you to create, build, and install PhoneGap apps for each of the supported platforms.
- PhoneGap vs Cordova CLI
Install node.js onto your system.
Open your Terminal (Terminal.app or iTerm2).
Install PhoneGap with the following command:
$ sudo npm install -g phonegap
Users who installed node.js into their user directory can discard sudo
. You
know who you are. If you aren't sure, then you probably need sudo.
Install node.js onto your system.
Install Git (I'd recommend msysGit)
Open the terminal Command Prompt for node.js or Git Bash.
Install PhoneGap with the following command:
$ npm install -g phonegap
Install node.js onto your system.
Open your favourite terminal.
Install PhoneGap with the following command:
$ npm install -g phonegap
Depending on how your package manager installed node.js, you may need to add sudo. You'll know because you'll receive an access denied error.
The PhoneGap CLI is used similar to other command-line tools.
While the PhoneGap CLI inherits from the Apache Cordova CLI, it does use different commands. This is annoying and will be changing very soon!
The good news is that the PhoneGap CLI is very helpful. You can add help to any command, and it will display an informative description of the command and how to use it.
Let's look at an example:
$ phonegap help
$ phonegap --help
$ phonegap -h
Display:
Usage: phonegap [options] [commands]
Description:
PhoneGap command-line tool.
Commands:
create <path> create a phonegap project
serve serve a phonegap project
build <platform> build the project for a specific platform
install <platform> install the project on for a specific platform
run <platform> build and install the project for a specific platform
local [command] development on local system
remote [command] development in cloud with phonegap/build
platform [command] update a platform version
plugin [command] add, remove, and list plugins
help [command] output usage information
version output version number
Options:
-d, --verbose allow verbose output
-v, --version output version number
-h, --help output usage information
Platforms:
keyword | local environment | remote environment
-------------------|---------------------|-------------------
android | Yes | Yes
blackberry | Yes | No
firefoxos | Yes | No
ios | Yes | Yes
wp8 | Yes | Yes
Examples:
$ phonegap help create
$ phonegap help remote build
$ phonegap create path/to/my-app
$ phonegap remote build android
$ phonegap help create
$ phonegap create help
$ phonegap create --help
$ phonegap create -h
Display:
Usage: phonegap create [options] <path> [id [name]]
Description:
Creates a new application at the provided path.
The application name and package ID can also be customized.
These values are set in the app manifest (www/config.xml) and are used when
creating a native project (platforms/<platform>/).
Options:
--name, -n <name> application name (default: "Hello World")
--id, -i <package> package name (default: "com.phonegap.hello-world")
Examples:
$ phonegap create path/to/my-app
$ phonegap create path/to/my-app "com.example.app" "My App"
$ phonegap create path/to/my-app --id "com.example.app" --name "My App"
The only help that help doesn't provide is about help. Yep.
By running $ phonegap help
we can see that $ phonegap create
is used
to creat a new project.
By running $ phonegap create help
we can see that $ phonegap create path/to/my-app
is the format to use.
So, let's create a new project!
# before running this command, change into a directory
# where you typically store development projects
$ phonegap create my-app
$ cd my-app/
Congratulations! You've created your first project!