How to use the cordova-lib.cordova_platforms function in cordova-lib

To help you get started, we’ve selected a few cordova-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kamrik / CordovaGulpTemplate / gulpfile.js View on Github external
var fs = require('fs');
var del = require('del');

var pkg = require('./package.json');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var cordova_lib = require('cordova-lib');
var cdv = cordova_lib.cordova.raw;
var buildDir = path.join(__dirname, 'build');


// List of platforms determined form pkd.dependencies. This way platform file
// downloading and version preferences are entirely handled by npm install.
var platforms = [];  // List like ['cordova-ios', 'cordova-android']
var platform_dirs = [];  // List of subdirs with platform files under node_moduels
for (p in cordova_lib.cordova_platforms) {
    var pname = 'cordova-' + p;
    if (pkg.dependencies[pname]) {
        platforms.push(pname);
        platform_dirs.push(path.join(__dirname, 'node_modules', pname));
        // TODO: Check if those dirs exist and if not ask the user to run "npm install"
    }

}


//////////////////////// TASKS /////////////////////////////

// All cordova-lib calls (except "cordova create") must be done from within
// the cordova project dir because cordova-lib determines projectRoot from
// process.cwd() in cordova-lib/src/cordova/util.js:isCordova()
github rcsole / gulp-cordova / wrapper.js View on Github external
function cordovaWrapper(commandArray, next) {

  var cmd = commandArray[0]
  var subcommand
  var msg
  var known_platforms = Object.keys(cordova_lib.cordova_platforms)

  /**
   * Output the error in terminal/console
   * @param dbgMsg
   */
  function callback (dbgMsg) {
    console.log(dbgMsg);
  }

  if (!cordova.hasOwnProperty(cmd)) {
    return callback('Cordova does not know ' + cmd)
  }

  var opts = {
    platforms: [],
    options: [],