From 6a8114e505d020741acb4445ea61c56e934c1795 Mon Sep 17 00:00:00 2001 From: Ronan Jouchet Date: Fri, 11 May 2018 16:55:50 -0400 Subject: [PATCH] Fix deprecations: electron-packager cb->promise, mocha compilers->require --- gulp/tests/mocha.js | 2 +- src/build/buildMain.js | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gulp/tests/mocha.js b/gulp/tests/mocha.js index 8aba174..37cc65c 100644 --- a/gulp/tests/mocha.js +++ b/gulp/tests/mocha.js @@ -13,7 +13,7 @@ gulp.task('mocha', (done) => { .pipe(istanbul.hookRequire()) // Force `require` to return covered files .on('finish', () => gulp.src(PATHS.TEST_SRC, { read: false }) .pipe(mocha({ - compilers: 'js:babel-core/register', + require: 'babel-core/register', recursive: true, })) .pipe(istanbul.writeReports({ diff --git a/src/build/buildMain.js b/src/build/buildMain.js index 3dc1480..84fe433 100644 --- a/src/build/buildMain.js +++ b/src/build/buildMain.js @@ -202,13 +202,15 @@ function buildMain(inpOptions, callback) { packagerConsole.override(); - packager(packageOptions, (error, appPathArray) => { - // restore console.error - packagerConsole.restore(); - - // pass options which still contains the icon to waterfall - cb(error, opts, appPathArray); - }); + packager(packageOptions) + .then(appPathArray => { + packagerConsole.restore(); // restore console.error + cb(null, opts, appPathArray); // options still contain the icon to waterfall + }) + .catch(error => { + packagerConsole.restore(); // restore console.error + cb(error, opts); // options still contain the icon to waterfall + }); }, (opts, appPathArray, cb) => { progress.tick('finalizing');