2014-12-05 19:26:30 -05:00
|
|
|
var util = require('./util');
|
|
|
|
var spawn = require('child_process').spawn;
|
|
|
|
|
2016-02-10 19:54:32 -05:00
|
|
|
module.exports = function(gulp, plugins, config) {
|
2014-12-05 19:26:30 -05:00
|
|
|
return function() {
|
2015-07-20 18:54:30 -04:00
|
|
|
config.port = config.port || 8080;
|
2015-04-06 17:48:07 -04:00
|
|
|
var pubMode = config.mode || 'debug';
|
2015-07-20 18:54:30 -04:00
|
|
|
var pubArgs = ['serve', '--mode', pubMode, '--port', config.port];
|
2015-04-06 17:48:07 -04:00
|
|
|
return util.streamToPromise(spawn(config.command, pubArgs, {
|
2015-07-20 18:54:30 -04:00
|
|
|
// pub serve is very spammy, and --verbosity flag doesn't fix it
|
2015-10-01 13:07:49 -04:00
|
|
|
cwd: config.path, stdio: 'inherit'
|
2014-12-05 19:26:30 -05:00
|
|
|
}));
|
|
|
|
};
|
|
|
|
};
|