cordova-common
Advanced tools
Comparing version 0.1.0 to 1.0.0
{ | ||
"author": "Apache Software Foundation", | ||
"name": "cordova-common", | ||
"description": "Apache Cordova tools and platforms shared routines", | ||
"license": "Apache-2.0", | ||
"version": "0.1.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git" | ||
}, | ||
"bugs": { | ||
"url": "https://issues.apache.org/jira/browse/CB", | ||
"email": "dev@cordova.apache.org" | ||
}, | ||
"main": "cordova-common.js", | ||
"engines": { | ||
"node": ">=0.9.9" | ||
}, | ||
"scripts": { | ||
"test": "npm run jshint && npm run jasmine", | ||
"jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec", | ||
"jasmine": "node node_modules/jasmine-node/bin/jasmine-node --captureExceptions --color spec", | ||
"cover": "node node_modules/istanbul/lib/cli.js cover --root src --print detail node_modules/jasmine-node/bin/jasmine-node -- spec" | ||
}, | ||
"engineStrict": true, | ||
"dependencies": { | ||
"bplist-parser": "^0.1.0", | ||
"cordova-registry-mapper": "^1.1.8", | ||
"elementtree": "^0.1.6", | ||
"glob": "^5.0.13", | ||
"osenv": "^0.1.3", | ||
"plist": "^1.1.0", | ||
"q": "^1.4.1", | ||
"semver": "^5.0.1", | ||
"shelljs": "^0.5.1", | ||
"underscore": "^1.8.3", | ||
"unorm": "^1.3.3" | ||
}, | ||
"devDependencies": { | ||
"istanbul": "^0.3.17", | ||
"jasmine-node": "^1.14.5", | ||
"jshint": "^2.8.0" | ||
}, | ||
"contributors": [] | ||
"author": "Apache Software Foundation", | ||
"name": "cordova-common", | ||
"description": "Apache Cordova tools and platforms shared routines", | ||
"license": "Apache-2.0", | ||
"version": "1.0.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://git-wip-us.apache.org/repos/asf/cordova-common.git" | ||
}, | ||
"bugs": { | ||
"url": "https://issues.apache.org/jira/browse/CB", | ||
"email": "dev@cordova.apache.org" | ||
}, | ||
"main": "cordova-common.js", | ||
"engines": { | ||
"node": ">=0.9.9" | ||
}, | ||
"scripts": { | ||
"test": "npm run jshint && npm run jasmine", | ||
"jshint": "node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint spec", | ||
"jasmine": "node node_modules/jasmine-node/bin/jasmine-node --captureExceptions --color spec", | ||
"cover": "node node_modules/istanbul/lib/cli.js cover --root src --print detail node_modules/jasmine-node/bin/jasmine-node -- spec" | ||
}, | ||
"engineStrict": true, | ||
"dependencies": { | ||
"bplist-parser": "^0.1.0", | ||
"cordova-registry-mapper": "^1.1.8", | ||
"elementtree": "^0.1.6", | ||
"glob": "^5.0.13", | ||
"osenv": "^0.1.3", | ||
"plist": "^1.1.0", | ||
"q": "^1.4.1", | ||
"semver": "^5.0.1", | ||
"shelljs": "^0.5.1", | ||
"underscore": "^1.8.3", | ||
"unorm": "^1.3.3" | ||
}, | ||
"devDependencies": { | ||
"istanbul": "^0.3.17", | ||
"jasmine-node": "^1.14.5", | ||
"jshint": "^2.8.0" | ||
}, | ||
"contributors": [] | ||
} |
122
README.md
@@ -23,8 +23,124 @@ <!-- | ||
# cordova-common | ||
Contains shared classes and routines used by [cordova-lib](https://github.com/apache/cordova-lib/) and platforms. | ||
Expoeses shared functionality used by [cordova-lib](https://github.com/apache/cordova-lib/) and Cordova platforms. | ||
## Exposed APIs | ||
### `events` | ||
Represents special instance of NodeJS EventEmitter which is intended to be used to post events to cordova-lib and cordova-cli | ||
Usage: | ||
``` | ||
var events = require('cordova-common').events; | ||
events.emit('warn', 'Some warning message') | ||
``` | ||
There are the following events supported 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 CordovaError instances is also valid Error instances (`instanceof` check succeeds). | ||
Usage: | ||
``` | ||
var CordovaError = require('cordova-common').CordovaError; | ||
throw new CordovaError('Some error message', SOME_ERR_CODE); | ||
``` | ||
See [CordovaError](src/CordovaError/CordovaError.js) for supported error codes. | ||
### `ConfigParser` | ||
Exposes functionality to deal with cordova project `config.xml` files. For ConfigParser API reference check [ConfigParser Readme](src/ConfigParser/README.md). | ||
Usage: | ||
``` | ||
var ConfigParser = require('cordova-common').ConfigParser; | ||
var 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: | ||
``` | ||
var PluginInfo: require('cordova-common').PluginInfo; | ||
var PluginInfoProvider: require('cordova-common').PluginInfoProvider; | ||
// The following instances are equal | ||
var plugin1 = new PluginInfo('path/to/plugin_directory'); | ||
var 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: | ||
``` | ||
var ActionStack = require('cordova-common').ActionStack; | ||
var stack = new ActionStack() | ||
var action1 = stack.createAction(task1, [<task parameters>], task1_reverter, [<reverter_parameters>]); | ||
var action2 = stack.createAction(task2, [<task parameters>], task2_reverter, [<reverter_parameters>]); | ||
stack.push(action1); | ||
stack.push(action2); | ||
stack.process() | ||
.then(function() { | ||
// all actions succeded | ||
}) | ||
.catch(function(error){ | ||
// One of actions failed with error | ||
}) | ||
``` | ||
### `superspawn` | ||
Module for spawning child processes with some advanced logic. | ||
Usage: | ||
``` | ||
var superspawn = require('cordova-common').superspawn; | ||
superspawn.spawn('adb', ['devices']) | ||
.then(function(devices){ | ||
// Do something... | ||
}) | ||
``` | ||
### `xmlHelpers` | ||
A set of utility methods for dealing with xml files. | ||
Usage: | ||
``` | ||
var xml = require('cordova-common').xmlHelpers; | ||
var xmlDoc1 = xml.parseElementtreeSync('some/xml/file'); | ||
var xmlDoc2 = xml.parseElementtreeSync('another/xml/file'); | ||
xml.mergeXml(doc1, doc2); // doc2 now contains all the nodes from doc1 | ||
``` | ||
### Other APIs | ||
The APIs listed below are also exposed but are intended to be only used internally by cordova plugin installation routines. | ||
``` | ||
PlatformJson | ||
ConfigChanges | ||
ConfigKeeper | ||
ConfigFile | ||
mungeUtil | ||
``` | ||
## Setup | ||
* Clone this repository onto your local machine. | ||
* Clone this repository onto your local machine | ||
`git clone https://git-wip-us.apache.org/repos/asf/cordova-lib.git` | ||
* In terminal, navigate to the inner cordova-common directory. | ||
* In terminal, navigate to the inner cordova-common directory | ||
`cd cordova-lib/cordova-common` | ||
@@ -31,0 +147,0 @@ * Install dependencies and npm-link |
@@ -23,3 +23,5 @@ <!-- | ||
### 0.1.0 (Oct 23, 2015) | ||
### 1.0.0 (Oct 29, 2015) | ||
* CB-9890 Documents cordova-common | ||
* CB-9598 Correct cordova-lib -> cordova-common in README | ||
@@ -26,0 +28,0 @@ * Pick ConfigParser changes from apache@0c3614e |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
106907
1
150
25
56
1