diff --git a/src/Runner.js b/src/Runner.js index af48101f..d172fd37 100644 --- a/src/Runner.js +++ b/src/Runner.js @@ -62,6 +62,10 @@ const log = { }, }; +function report({file, msg}) { + bufferedWrite(lineBreak(`${colors.white.bgBlue(' REP ')}${file} ${msg}`)); +} + function concatAll(arrays) { const result = []; for (const array of arrays) { @@ -276,6 +280,9 @@ function run(transformFile, paths, options) { case 'free': child.send({files: next(), options}); break; + case 'report': + report(message); + break; } }); return new Promise(resolve => child.on('disconnect', resolve)); diff --git a/src/Worker.js b/src/Worker.js index c822af1d..62033509 100644 --- a/src/Worker.js +++ b/src/Worker.js @@ -64,6 +64,7 @@ function setup(tr, babel) { ] }); } + const module = require(tr); transform = typeof module.default === 'function' ? module.default : @@ -80,10 +81,14 @@ function free() { } function updateStatus(status, file, msg) { - msg = msg ? file + ' ' + msg : file; + msg = msg ? file + ' ' + msg : file; notify({action: 'status', status: status, msg: msg}); } +function report(file, msg) { + notify({action: 'report', file, msg}); +} + function empty() {} function stats(name, quantity) { @@ -134,7 +139,8 @@ function run(data) { { j: jscodeshift, jscodeshift: jscodeshift, - stats: options.dry ? stats : empty + stats: options.dry ? stats : empty, + report: msg => report(file, msg), }, options );