watch-test.js 534 Bytes
var browserify = require('browserify');
var fs = require('fs');
var glob = require('glob');
var watchify = require('watchify');

glob('test/{m3u8,stub}.test.js', function(err, files) {
  var b = browserify(files, {
    cache: {},
    packageCache: {},
    plugin: [watchify]
  }).transform('babelify');

  var bundle = function() {
    b.bundle().pipe(fs.createWriteStream('dist-test/videojs-contrib-hls.js'));
  };

  b.on('log', function(msg) {
    process.stdout.write(msg + '\n');
  });

  b.on('update', bundle);
  bundle();
});