Go to the directory where you maintain your source code, and create a cordova project:
$ cordova create hello com.example.hello HelloWorld
This creates the required directory structure for your cordova app. By default, the cordova create script generates a skeletal web-based application whose home page is the project’s www/index.html file.
C:\>D: D:\>cd Cordova D:\Cordova>cordova create zship com.zship.hello zship ? May Cordova anonymously report usage statistics to improve the tool over time? Yes Thanks for opting into telemetry to help us improve cordova. Creating a new cordova project.
Cordova project directory structure
Cordova CLI works with the following directory structure:
| | |-- android/
| | |-- windows/
| | |-- ios/
| |-- android/
| |-- windows/
| |-- ios/
Configures your application and allows you to customize the behavior of your project. See also config.xml reference documentation
Contains the project’s web artifacts, such as .html, .css and .js files. As a cordova application developer, most of your code and assets will go here. They will be copied on a cordova prepare to each platform’s www directory. The www source directory is reproduced within each platform’s subdirectory, appearing for example in platforms/ios/www or platforms/android/assets/www. Because the CLI constantly copies over files from the source www folder, you should only edit these files and not the ones located under the platforms subdirectories. If you use version control software, you should add this source www folder, along with the merges folder, to your version control system.
Contains all the source code and build scripts for the platforms that you add to your project.
WARNING: When using the CLI to build your application, you should not edit any files in the /platforms/ directory unless you know what you are doing, or if documentation specifies otherwise. The files in this directory are routinely overwritten when preparing applications for building, or when plugins are re-installed.
Any added plugins will be extracted or copied into this directory.
This directory may contains scripts used to customize cordova-cli commands. Any scripts you add to these directories will be executed before and after the commands corresponding to the directory name. Useful for integrating your own build systems or integrating with version control systems.
Refer to Hooks Guide for more information.
| -- app.js
| -- android.js
After building the Android and iOS projects, the Android application will contain both app.js and android.js. However, the iOS application will only contain an app.js, and it will be the one from merges/ios/app.js, overriding the “common” app.js located inside www/.