Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
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: [],