cordova-common
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -29,2 +29,3 @@ /** | ||
CordovaError: require('./src/CordovaError/CordovaError'), | ||
CordovaLogger: require('./src/CordovaLogger'), | ||
CordovaExternalToolErrorContext: require('./src/CordovaError/CordovaExternalToolErrorContext'), | ||
@@ -31,0 +32,0 @@ PlatformJson: require('./src/PlatformJson'), |
{ | ||
"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": [] | ||
"author": "Apache Software Foundation", | ||
"name": "cordova-common", | ||
"description": "Apache Cordova tools and platforms shared routines", | ||
"license": "Apache-2.0", | ||
"version": "1.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": { | ||
"ansi": "^0.3.1", | ||
"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.2.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": [] | ||
} |
@@ -110,2 +110,6 @@ <!-- | ||
superspawn.spawn('adb', ['devices']) | ||
.progress(function(data){ | ||
if (data.stderr) | ||
console.error('"adb devices" raised an error: ' + data.stderr); | ||
}) | ||
.then(function(devices){ | ||
@@ -112,0 +116,0 @@ // Do something... |
@@ -23,2 +23,10 @@ <!-- | ||
### 1.1.0 (Feb 16, 2016) | ||
* CB-10482 Remove references to windows8 from cordova-lib/cli | ||
* CB-10430 Adds forwardEvents method to easily connect two EventEmitters | ||
* CB-10176 Adds CordovaLogger class, based on logger module from cordova-cli | ||
* CB-10052 Expose child process' io streams via promise progress notification | ||
* CB-10497 Prefer .bat over .cmd on windows platform | ||
* CB-9984 Bumps plist version and fixes failing cordova-common test | ||
### 1.0.0 (Oct 29, 2015) | ||
@@ -25,0 +33,0 @@ |
@@ -109,4 +109,4 @@ /* | ||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) { | ||
// New windows template separate manifest files for Windows8, Windows8.1 and WP8.1 | ||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest']; | ||
// New windows template separate manifest files for Windows10, Windows8.1 and WP8.1 | ||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest']; | ||
/* jshint loopfunc:true */ | ||
@@ -153,3 +153,3 @@ substs.forEach(function(subst) { | ||
!fs.existsSync(path.join(self.project_dir, 'package.appxmanifest'))) { | ||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows80.appxmanifest', 'package.windows10.appxmanifest']; | ||
var substs = ['package.phone.appxmanifest', 'package.windows.appxmanifest', 'package.windows10.appxmanifest']; | ||
/* jshint loopfunc:true */ | ||
@@ -208,3 +208,2 @@ substs.forEach(function(subst) { | ||
'windows': { | ||
'8.0.0': 'package.windows80.appxmanifest', | ||
'8.1.0': 'package.windows.appxmanifest', | ||
@@ -218,3 +217,2 @@ '10.0.0': 'package.windows10.appxmanifest' | ||
'all': { | ||
'8.0.0': 'package.windows80.appxmanifest', | ||
'8.1.0': ['package.windows.appxmanifest', 'package.phone.appxmanifest'], | ||
@@ -221,0 +219,0 @@ '10.0.0': 'package.windows10.appxmanifest' |
@@ -19,2 +19,48 @@ /** | ||
*/ | ||
module.exports = new (require('events').EventEmitter)(); | ||
var EventEmitter = require('events').EventEmitter; | ||
var INSTANCE = new EventEmitter(); | ||
var EVENTS_RECEIVER; | ||
module.exports = INSTANCE; | ||
/** | ||
* Sets up current instance to forward emitted events to another EventEmitter | ||
* instance. | ||
* | ||
* @param {EventEmitter} [eventEmitter] The emitter instance to forward | ||
* events to. Falsy value, when passed, disables forwarding. | ||
*/ | ||
module.exports.forwardEventsTo = function (eventEmitter) { | ||
// If no argument is specified disable events forwarding | ||
if (!eventEmitter) { | ||
EVENTS_RECEIVER = undefined; | ||
return; | ||
} | ||
if (!(eventEmitter instanceof EventEmitter)) | ||
throw new Error('Cordova events could be redirected to another EventEmitter instance only'); | ||
EVENTS_RECEIVER = eventEmitter; | ||
}; | ||
var emit = INSTANCE.emit; | ||
/** | ||
* This method replaces original 'emit' method to allow events forwarding. | ||
* | ||
* @return {eventEmitter} Current instance to allow calls chaining, as | ||
* original 'emit' does | ||
*/ | ||
module.exports.emit = function () { | ||
var args = Array.prototype.slice.call(arguments); | ||
if (EVENTS_RECEIVER) { | ||
EVENTS_RECEIVER.emit.apply(EVENTS_RECEIVER, args); | ||
} | ||
return emit.apply(this, args); | ||
}; |
@@ -379,5 +379,2 @@ /** | ||
var platformTag = pelem.find('./platform[@name="' + platform + '"]'); | ||
if (platform == 'windows' && !platformTag) { | ||
platformTag = pelem.find('platform[@name="' + 'windows8' + '"]'); | ||
} | ||
var tagsInRoot = pelem.findall(tag); | ||
@@ -396,5 +393,2 @@ tagsInRoot = tagsInRoot || []; | ||
var platformTag = pelem.find('./platform[@name="' + platform + '"]'); | ||
if (platform == 'windows' && !platformTag) { | ||
platformTag = pelem.find('platform[@name="' + 'windows8' + '"]'); | ||
} | ||
var tags = platformTag ? platformTag.findall(tag) : []; | ||
@@ -401,0 +395,0 @@ if ( typeof transform === 'function' ) { |
@@ -31,3 +31,3 @@ /** | ||
function resolveWindowsExe(cmd) { | ||
var winExtensions = ['.exe', '.cmd', '.bat', '.js', '.vbs']; | ||
var winExtensions = ['.exe', '.bat', '.cmd', '.js', '.vbs']; | ||
function isValidExe(c) { | ||
@@ -56,11 +56,35 @@ return winExtensions.indexOf(path.extname(c)) !== -1 && fs.existsSync(c); | ||
// opts: | ||
// printCommand: Whether to log the command (default: false) | ||
// stdio: 'default' is to capture output and returning it as a string to success (same as exec) | ||
// 'ignore' means don't bother capturing it | ||
// 'inherit' means pipe the input & output. This is required for anything that prompts. | ||
// env: Map of extra environment variables. | ||
// cwd: Working directory for the command. | ||
// chmod: If truthy, will attempt to set the execute bit before executing on non-Windows platforms. | ||
// Returns a promise that succeeds only for return code = 0. | ||
/** | ||
* A special implementation for child_process.spawn that handles | ||
* Windows-specific issues with batch files and spaces in paths. Returns a | ||
* promise that succeeds only for return code 0. It is also possible to | ||
* subscribe on spawned process' stdout and stderr streams using progress | ||
* handler for resultant promise. | ||
* | ||
* @example spawn('mycommand', [], {stdio: 'pipe'}) .progress(function (stdio){ | ||
* if (stdio.stderr) { console.error(stdio.stderr); } }) | ||
* .then(function(result){ // do other stuff }) | ||
* | ||
* @param {String} cmd A command to spawn | ||
* @param {String[]} [args=[]] An array of arguments, passed to spawned | ||
* process | ||
* @param {Object} [opts={}] A configuration object | ||
* @param {String|String[]|Object} opts.stdio Property that configures how | ||
* spawned process' stdio will behave. Has the same meaning and possible | ||
* values as 'stdio' options for child_process.spawn method | ||
* (https://nodejs.org/api/child_process.html#child_process_options_stdio). | ||
* @param {Object} [env={}] A map of extra environment variables | ||
* @param {String} [cwd=process.cwd()] Working directory for the command | ||
* @param {Boolean} [chmod=false] If truthy, will attempt to set the execute | ||
* bit before executing on non-Windows platforms | ||
* | ||
* @return {Promise} A promise that is either fulfilled if the spawned | ||
* process is exited with zero error code or rejected otherwise. If the | ||
* 'stdio' option set to 'default' or 'pipe', the promise also emits progress | ||
* messages with the following contents: | ||
* { | ||
* 'stdout': ..., | ||
* 'stderr': ... | ||
* } | ||
*/ | ||
exports.spawn = function(cmd, args, opts) { | ||
@@ -88,13 +112,15 @@ args = args || []; | ||
if (opts.stdio == 'ignore') { | ||
spawnOpts.stdio = 'ignore'; | ||
} else if (opts.stdio == 'inherit') { | ||
spawnOpts.stdio = 'inherit'; | ||
if (opts.stdio !== 'default') { | ||
// Ignore 'default' value for stdio because it corresponds to child_process's default 'pipe' option | ||
spawnOpts.stdio = opts.stdio; | ||
} | ||
if (opts.cwd) { | ||
spawnOpts.cwd = opts.cwd; | ||
} | ||
if (opts.env) { | ||
spawnOpts.env = _.extend(_.extend({}, process.env), opts.env); | ||
} | ||
if (opts.chmod && !iswin32) { | ||
@@ -119,7 +145,11 @@ try { | ||
capturedOut += data; | ||
d.notify({'stdout': data}); | ||
}); | ||
} | ||
if (child.stderr) { | ||
child.stderr.setEncoding('utf8'); | ||
child.stderr.on('data', function(data) { | ||
capturedErr += data; | ||
d.notify({'stderr': data}); | ||
}); | ||
@@ -126,0 +156,0 @@ } |
116016
26
2652
154
12
+ Addedansi@^0.3.1
+ Addedansi@0.3.1(transitive)
Updatedplist@^1.2.0