Giter Site home page Giter Site logo

steal-cordova's Introduction

npm version

steal-cordova

Develop your project as a web application and then simply use steal-cordova to create Android and iOS Cordova apps.

Install

npm install steal-cordova --save-dev

If you are developing for android you also need to install the Android SDK and Ant. You have a lot of options on how to do this. If using OSX the easiest way is with Homebrew:

brew install android-sdk ant

After installing set the ANDROID_HOME environmental variable:

export ANDROID_HOME=/usr/local/opt/android-sdk

To make this permanent set it in your .bashrc or .zshrc or whatever shell you use.

Example

steal-cordova needs a BuildResult object which you get from running StealTools multi-build:

var stealTools = require("steal-tools");

var cordovaOptions = {
  buildDir: "./build/cordova",
  id: "com.hello.world",
  name: "HelloWorld",
  platforms: ["ios", "android"],
  index: __dirname + "/index.html"
};

var stealCordova = require("steal-cordova")(cordovaOptions);

var buildPromise = stealTools.build({
  config: __dirname + "/package.json!npm"
});

buildPromise.then(stealCordova.build);

API

Pass in your Cordova options to steal-cordova to create a stealCordova object that can be used to run builds, start emulators and run on Android devices.

stealCordova

var stealCordova = require("steal-cordova")(cordovaOptions);

stealCordova.build

stealCordova.build(buildResult) -> Promise

Pass a BuildResult object from StealTools' multi build. Returns a Promise that will resolve when the Cordova application has built.

stealCordova.android.emulate

stealCordova.android.emulate() -> Promise

Call to start an Android emulator with your project. Returns a promise that will resolve when the application has booted.

stealCordova.android.run

stealCordova.android.run() -> Promise

Run your application on an Android device. Device must be connected prior to running this command.

stealCordova.ios.emulate

stealCordova.ios.emulate() -> Promise

Call to start an iOS emulator running your application. Promise will resolve after the application has booted.

Configuration

CordovaOptions

Supports same options as node-webkit-builder, but at minimum needs:

buildDir

id

name

platforms

License

MIT

steal-cordova's People

Contributors

alfredo-delgado avatar chasenlehara avatar cherifgsoul avatar greenkeeper[bot] avatar matthewp avatar phillipskevin avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

steal-cordova's Issues

Failure to launch: iOS simulator

Not sure where the actual root of the problem is, whether it's x-code 9, or the lates ios-sim version or what, but when trying to launch the demo from this repository:

image

output

** BUILD SUCCEEDED **


No target specified for emulator. Deploying to undefined simulator


Device type "com.apple.CoreSimulator.SimDeviceType.undefined" could not be found.

Done-> cordova emulate ios
Error-> with Parallel tasks1

...and no simulator launches.

This is the same error i get when running the DoneJS Cordova build (donejs build cordova) as well, so currently the guides are not working fully on iOS.

Here is an ios-sim issue possibly related:
ios-control/ios-sim#218

<script src="cordova.js"></script> Missing causing plugins not to work

I have a cordova project which I would like to use cordova plugins for; however, they require the inclusion of cordova.js (that's in the same folder as index.html). There is currently not a way to do this that I've found. There may be a work around which I'm exploring right now, but it would be nice if this functionality were included out of the box. Let me know if this isn't clear or more details are needed.

Error Adding Cordova Plugins

Some problems adding cordova plugin in the cordovaOptions. Got 404 error when retriving the file from the npm registry.
cordova_plugin_map should be updated.

For instance:
org.apache.cordova.geolocation
with
cordova-plugin-geolocation

cordovaOptions glob array resources copy not being waited for

This seems to be a race-condition.
This has been an issue before we upgraded to steal-cordova 1.0.0 but it seems that the upgrade made the problem go from having to run the build command a few times, to it not working at all unless we take out the command to delete the build directory from the start of our build script.

The error complains that a file specified in the glob array used with steal-cordova does not exist. The file that errors is different each time until the build finally succeeds.

Installing "cordova-plugin-email-composer" for ios


Done-> cordova plugin add cordova-plugin-email-composer
Running:/Users/sinjhin/Workspace/myproject/node_modules/cordova/bin/cordova plugin add cordova-plugin-device
Fetching plugin "cordova-plugin-device" via npm


Installing "cordova-plugin-device" for ios


Done-> cordova plugin add cordova-plugin-device
Success-> with Series tasks
Success-> with Series tasks
Potentially unhandled rejection [3] Error: ENOENT: no such file or directory, chmod '/Users/sinjhin/Workspace/myproject/build/cordova/www/resources/icons/android/icon-144-xxhdpi.png'
    at Error (native)

The temp fix has been to remove npm run clean && from our build script "build": "npm run clean && node build" in our package.json to keep the build dir contents intact. We still have to run the build 2-7 times before it stops giving the file errors listed above. Once the build succeeds it always seems to work the 1st time.

When switching between an iOS and Android build I manually delete the build folder and have to go through the 2-7 runs again for it to complete.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.