don't require bluebird

This commit is contained in:
AJ ONeal 2016-10-13 19:31:52 -06:00
parent 2bd05345d2
commit d031ad10a1
1 changed files with 8 additions and 1 deletions

9
lex.js
View File

@ -10,7 +10,14 @@ module.exports.create = function (opts) {
}; };
opts.listen = function (plainPort, port) { opts.listen = function (plainPort, port) {
var PromiseA = require('bluebird'); var PromiseA;
try {
PromiseA = require('bluebird');
} catch(e) {
console.warn("Package 'bluebird' not installed. Using global.Promise instead");
console.warn("(want bluebird instead? npm install --save bluebird)");
PromiseA = global.Promise;
}
var promises = []; var promises = [];
var plainPorts = plainPort; var plainPorts = plainPort;
var ports = port; var ports = port;