From 063472a07ea8eaa985373e147c21c6ba8f9f01f9 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 22 Jun 2018 11:12:34 -0400 Subject: [PATCH] skip build if cmpile only --- lib/index.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/index.js b/lib/index.js index 005de949..e32d1238 100644 --- a/lib/index.js +++ b/lib/index.js @@ -194,7 +194,7 @@ class Embark { engine.startService("libraryManager"); engine.startService("codeRunner"); engine.startService("web3"); - if(!options.onlyCompile){ + if (!options.onlyCompile) { engine.startService("pipeline"); } engine.startService("deployment", {onlyCompile: options.onlyCompile}); @@ -208,24 +208,30 @@ class Embark { }); }, function waitForWriteFinish(callback) { + if (options.onlyCompile) { + engine.logger.info("Finished compiling".underline); + return callback(null, true); + } engine.logger.info("Finished deploying".underline); - // Necessary log for simple projects. This event is trigger to soon because there is no file - // Also, not exiting straight after the deploy leaves time for async afterDeploys to finish - if(options.onlyCompile){ + if (!engine.config.assetFiles || !Object.keys(engine.config.assetFiles).length) { return callback(); } - engine.logger.info("If you have no files to build, you can exit now with CTRL+C"); - engine.events.on('outputDone', callback); + engine.events.on('outputDone', (err) => { + engine.logger.info(__("finished building").underline); + callback(err, true); + }); } - ], function (err, _result) { + ], function (err, canExit) { if (err) { engine.logger.error(err.message); engine.logger.debug(err.stack); - } else { - engine.logger.info(__("finished building").underline); } - // needed due to child processes - process.exit(); + + if (canExit || !engine.config.contractsConfig.afterDeploy || !engine.config.contractsConfig.afterDeploy.length) { + process.exit(); + } + engine.logger.info(__('Waiting for after deploy to finish...')); + engine.logger.info(__('You can exit with CTRL+C when after deploy completes')); }); }