Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'cordova-lib' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
};
// Check if config file exists, if not warn the user.
if (config) {
try {
fs.accessSync(configFile, fs.F_OK);
} catch (e) {
console.log('Warning: build file not found, using defaults...');
}
}
// switch to cordova directory
process.chdir('./cordova');
// build with options and distribute to Fabric if specified
return cordova.raw.build(buildOpts).then(
function() {
if (distribute) {
fabric.distribute(platforms, target);
}
},
function(error) {
console.log('Build failed:', error);
}
);
};
if (!platform) {
var platarg = options.platforms[0];
self.phonegap.emit('error', {message:PG_STR.platerr[0]+platarg+PG_STR.platerr[1]+ platarg + PG_STR.platerr[2]});
return;
}
// change to project directory and delegate errors
if (!project.cd({ emitter: self.phonegap, callback: callback })) return;
// detect the platform support
self.phonegap.emit('log', 'detecting', platform.human, 'SDK environment...');
try {
// will throw if element in options.platforms isn't recognized
cordova.platform('', options.platforms, null)
// invoke local build
var env = 'local';
self.phonegap.emit('log', PG_STR.useenv[0], env, PG_STR.useenv[1]);
self.phonegap[env].run(options, callback);
} catch (e) {
// invoke remote build
var env = 'remote';
self.phonegap.emit('log', PG_STR.useenv[0], env, PG_STR.useenv[1]);
self.phonegap[env].run(options, callback);
};
};
callback(new Error(msg));
return;
}
// change to project directory and delegate errors
if (!project.cd({ emitter: self.phonegap, callback: callback })) return;
self.phonegap.emit('log', PG_STR.msgdet[0], platform.human, PG_STR.msgdet[1]);
try {
// will throw if element in options.platform isn't recognized
installed = project.listPlatforms('.');
if (!(options.platforms[0] in installed)) {
cordova.platform('add', options.platforms, null, function(e){
// invoke local build
install.apply(self, ['local', options, callback]);
});
}
} catch (e) {
// invoke remote build
install.apply(self, ['remote', options, callback]);
}
};
env = '';
if (!platform) {
var platarg = options.platforms[0];
self.phonegap.emit('error', {message:PG_STR.platerr[0]+platarg+PG_STR.platerr[1]+ platarg + PG_STR.platerr[2]});
return;
}
// change to project directory and delegate errors
if (!project.cd({ emitter: self.phonegap, callback: callback })) return;
self.phonegap.emit('log', PG_STR.msgdet[0], platform.human, PG_STR.msgdet[1]);
// detect the platform support
try {
cordova.platform('.', platform.local, null);
// invoke local or remote build
var env = 'local';
self.phonegap.emit('log', PG_STR.useenv[0], env, PG_STR.useenv[1]);
self.phonegap[env].build(options, callback);
} catch (e) {
var env = 'remote';
// emit a non-exiting message to stderr, incase user wants to react to local build failure
self.phonegap.emit('error', e);
self.phonegap.emit('log', PG_STR.useenv[0], env, PG_STR.useenv[1]);
self.phonegap[env].build(options, callback);
};
};
// validate parameters
if (options.platforms.length < 1) {
var e = new Error('missing a platform to update');
self.phonegap.emit('error', e);
callback(e);
return;
}
// change to project directory and delegate errors
if (!project.cd({ emitter: self.phonegap, callback: callback })) return;
for (each in self.phonegap.version())
{ self.phonegap.emit('log', each);}
self.phonegap.emit('log', 'updating ' + platform.human + ' platform using PhoneGap CLI version ' + project.readPackage().version );
// update the platform
cordova.platform('update', [ platform.local ], function(e) {
if (e) {
self.phonegap.emit('error', e);
callback(e);
return;
}
self.phonegap.emit('log', 'successfully update', platform.human, 'platform');
callback(null);
});
};
var path = require('path');
var fs = require('fs');
var Q = require('q');
var mkdirp = require('mkdirp');
var rimraf = require('rimraf')
var cordova = require('cordova-lib');
var glob = require('glob');
var CONFIG_XML = "";
var STRING_XML = '';
var ANDROID_MANIFEST = "";
var PLUGIN_GRADLE = "dependencies {compile fileTree(dir: 'libs', include: '*.jar')\n// SUB-PROJECT DEPENDENCIES START\n\n// SUB-PROJECT DEPENDENCIES END\n}\n// PLUGIN GRADLE EXTENSIONS START\n// PLUGIN GRADLE EXTENSIONS END";
var PLATFORM_DIR = path.resolve(__dirname, '../platforms/android');
cordova.events.on('verbose', console.log.bind(console));
cordova.events.on('log', console.log.bind(console));
function Android(projectRoot) {
this.projectRoot = projectRoot;
}
Android.prototype.init = function () {
if (this.isInitialized) {
return;
}
createDirectories(['src', 'libs', 'res/xml', 'res/values', 'assets/www']);
writeIfNotExists('res/xml/config.xml', CONFIG_XML);
writeIfNotExists('res/values/strings.xml', STRING_XML);
writeIfNotExists('project.properties', '');
writeIfNotExists('plugin-build.gradle', PLUGIN_GRADLE);
writeIfNotExists('AndroidManifest.xml', ANDROID_MANIFEST);
var fs = require('fs');
var Q = require('q');
var mkdirp = require('mkdirp');
var rimraf = require('rimraf')
var cordova = require('cordova-lib');
var glob = require('glob');
var CONFIG_XML = "";
var STRING_XML = '';
var ANDROID_MANIFEST = "";
var PLUGIN_GRADLE = "dependencies {compile fileTree(dir: 'libs', include: '*.jar')\n// SUB-PROJECT DEPENDENCIES START\n\n// SUB-PROJECT DEPENDENCIES END\n}\n// PLUGIN GRADLE EXTENSIONS START\n// PLUGIN GRADLE EXTENSIONS END";
var PLATFORM_DIR = path.resolve(__dirname, '../platforms/android');
cordova.events.on('verbose', console.log.bind(console));
cordova.events.on('log', console.log.bind(console));
function Android(projectRoot) {
this.projectRoot = projectRoot;
}
Android.prototype.init = function () {
if (this.isInitialized) {
return;
}
createDirectories(['src', 'libs', 'res/xml', 'res/values', 'assets/www']);
writeIfNotExists('res/xml/config.xml', CONFIG_XML);
writeIfNotExists('res/values/strings.xml', STRING_XML);
writeIfNotExists('project.properties', '');
writeIfNotExists('plugin-build.gradle', PLUGIN_GRADLE);
writeIfNotExists('AndroidManifest.xml', ANDROID_MANIFEST);
console.log('Initialized Android resources');
command = ((args)[0] || 'cordova');
docdir = path.join(__dirname, '..', 'doc');
file = [
command + '.md',
command + '.txt',
'cordova.md',
'cordova.txt'
].map(function (file) {
var f = path.join(docdir, file);
if (fs.existsSync(f)) {
return f;
}
}).filter(function (f) {
return !!f;
});
raw = fs.readFileSync(file[0]).toString('utf8').replace(/cordova-cli/g, cordova_lib.binname);
// cordova.emit('results', raw);
return raw;
};
'use strict';
var assert = require('assert');
var Q = require('q');
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
var cordova_lib = require('cordova-lib');
var plugman = cordova_lib.plugman;
var cordova = cordova_lib.cordova;
//============================================================================
// CONFIGURE
//
var TEST_FRAMEWORK = 'http://git-wip-us.apache.org/repos/asf/cordova-plugin-test-framework.git';
//============================================================================
// Yeoman generator implementation
//
module.exports = yeoman.generators.Base.extend({
constructor: function (args, options, config) {
yeoman.generators.Base.apply(this, arguments);
this.props = options;
},
var assert = require('assert');
var yeoman = require('yeoman-generator');
var fs = require('fs');
var xml2js = require('xml2js');
var cordova_lib = require('cordova-lib');
var plugman = cordova_lib.plugman;
//============================================================================
// Yeoman generator implementation
//
module.exports = yeoman.generators.Base.extend({
constructor: function (args, options, config) {
yeoman.generators.Base.apply(this, arguments);
this.props = options;
},
//==========================================================================
// Create plugin
//--------------------------------------------------------------------------
// Run plugman: create plugin
//