Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
cordova-common
Advanced tools
Apache Cordova tools and platforms shared routines
Exposes shared functionality used by cordova-lib and Cordova platforms.
events
Represents special instance of NodeJS EventEmitter
which is intended to be used to post events to cordova-lib
and cordova-cli
Usage:
const { events } = require('cordova-common');
events.emit('warn', 'Some warning message')
Here are the following supported events by cordova-cli
:
verbose
log
info
warn
error
CordovaError
An error class used by Cordova to throw cordova-specific errors. The CordovaError
class is inherited from Error
, so it is a valid instance of Error
. (instanceof
check succeeds).
Usage:
const { CordovaError } = require('cordova-common');
throw new CordovaError('Some error message', SOME_ERR_CODE);
See CordovaError for supported error codes.
ConfigParser
Exposes functionality to deal with cordova project config.xml
files. For ConfigParser
API reference check ConfigParser Readme.
Usage:
const { ConfigParser } = require('cordova-common');
const appConfig = new ConfigParser('path/to/cordova-app/config.xml');
console.log(`${appconfig.name()}:${appConfig.version()}`);
PluginInfoProvider
and PluginInfo
PluginInfo
is a wrapper for cordova plugins' plugin.xml
files. This class may be instantiated directly or via PluginInfoProvider
. The difference is that PluginInfoProvider
caches PluginInfo
instances based on plugin source directory.
Usage:
const { PluginInfo, PluginInfoProvider } = require('cordova-common');
// The following instances are equal
const plugin1 = new PluginInfo('path/to/plugin_directory');
const plugin2 = new PluginInfoProvider().get('path/to/plugin_directory');
console.log(`The plugin ${plugin1.id} has version ${plugin1.version}`)
ActionStack
Utility module for dealing with sequential tasks. Provides a set of tasks that are needed to be done and reverts all tasks that are already completed if one of those tasks fail to complete. Used internally by cordova-lib
and platform's plugin installation routines.
Usage:
const { ActionStack } = require('cordova-common');
const stack = new ActionStack();
const action1 = stack.createAction(task1, [<task parameters>], task1_reverter, [<reverter_parameters>]);
const action2 = stack.createAction(task2, [<task parameters>], task2_reverter, [<reverter_parameters>]);
stack.push(action1);
stack.push(action2);
stack.process()
.then(() => {
// all actions succeded
})
.catch(error => {
// One of actions failed with error
});
superspawn
Module for spawning child processes with some advanced logic.
Usage:
const { superspawn } = require('cordova-common');
superspawn.spawn('adb', ['devices'])
.progress(data => {
if (data.stderr) console.error(`"adb devices" raised an error: ${data.stderr}`);
})
.then(devices => {
// Do something...
});
xmlHelpers
A set of utility methods for dealing with XML files.
Usage:
const { xmlHelpers } = require('cordova-common');
const doc1 = xmlHelpers.parseElementtreeSync('some/xml/file');
const doc2 = xmlHelpers.parseElementtreeSync('another/xml/file');
xmlHelpers.mergeXml(doc1, doc2); // doc2 now contains all the nodes from doc1
The APIs listed below are also exposed but are intended to be only used internally by cordova plugin installation routines.
PlatformJson
ConfigChanges
ConfigKeeper
ConfigFile
Clone this repository onto your local machine
git clone https://github.com/apache/cordova-common.git
Navigate to cordova-common directory, install dependencies and npm-link
cd cordova-common && npm install && npm link
Navigate to cordova-lib directory and link cordova-common
cd <cordova-lib directory> && npm link cordova-common && npm install
FAQs
Apache Cordova tools and platforms shared routines
The npm package cordova-common receives a total of 53,775 weekly downloads. As such, cordova-common popularity was classified as popular.
We found that cordova-common demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.