createmobilespec.js
is a script for creating a test app that has:
cordova-mobile-spec
cordova.js
file that is freshly built from the local cordova-js
foldercordova-android
)cordova-plugin-device
)cordova-cli
and cordova-plugman
foldersIn other words, it is a great way to test your local development efforts.
The script also has options for creating the test app using a globally-installed npm module, a way to use the platform's cordova.js
file instead of building it from the local cordova-js
git repo, and a way to use the platform-centered workflow instead of the CLI.
Your Cordova projects have to be checked out and set up in a very specific way: All checkouts have to be siblings (= same parent folder) and the common Cordova libraries have to be npm-linked.
The easiest and quickest way to achieve this is by using cordova-coho
:
# Create a new folder, e.g. `cordova` and `cd cordova` into it. git clone https://github.com/apache/cordova-coho.git cd cordova-coho & npm install & cd .. node cordova-coho/coho repo-clone -r mobile-spec -r tools -r plugins -r active-platforms node cordova-coho/coho npm-link
After this you should have 30+ folders in your cordova
folder.
As cordova-mobile-spec
has a special structure, you have to install dependencies in createmobilespec
manually:
cd cordova-mobile-spec/createmobilespec & npm install & cd ../..
You are now ready to use createmobilespec.js
with the commands below.
The createmobilespec.js
script also needs to be invoked from the “main” folder you created before (cordova
):
cordova-mobile-spec/createmobilespec/createmobilespec.js
On Windows, prefix all commands with node
:
node cordova-mobile-spec/createmobilespec/createmobilespec.js
To see the options available in the script, run it with the -h
option to print the online help.
(node) cordova-mobile-spec/createmobilespec/createmobilespec.js -h
If anything is going wrong and the existing output does not help, add the --debug
parameter:
(node) cordova-mobile-spec/createmobilespec/createmobilespec.js --debug
Caution: If the generated mobilespec
project already exists, it is recommended to delete the project before proceeding.
To for example create the app for the Android platform, run:
(node) cordova-mobile-spec/createmobilespec/createmobilespec.js --android
After the script successfully finished and created the app, you can run the app on a device or simulator, using the standard method for that platform(s). For example on Android:
cd mobilespec ./cordova run android
Some known quirks and issues: