From 953980d586d19cefa912cdc7b376a1ad2ee3efdb Mon Sep 17 00:00:00 2001 From: Harrison Ifeanyichukwu Date: Mon, 22 Jun 2020 23:50:29 +0200 Subject: [PATCH] fix: terminate process on exit --- bin/index.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/bin/index.js b/bin/index.js index b3b0cc4..c82c7ee 100755 --- a/bin/index.js +++ b/bin/index.js @@ -15,16 +15,22 @@ args.options([ }, ]); -const flags = args.parse(process.argv); -const getEntryPath = require('@teclone/node-utils').getEntryPath; +const run = () => { + const flags = args.parse(process.argv); + const getEntryPath = require('@teclone/node-utils').getEntryPath; -const loadFile = require(`${flags.dir}/modules/utils`).loadFile; -const Bundler = require(`${flags.dir}/modules/Bundler`).Bundler; + const loadFile = require(`${flags.dir}/modules/utils`).loadFile; + const Bundler = require(`${flags.dir}/modules/Bundler`).Bundler; -const entryPath = getEntryPath(); -const options = loadFile(entryPath, 'rollup.config.js'); + const entryPath = getEntryPath(); + const options = loadFile(entryPath, 'rollup.config.js'); -const bunder = new Bundler(options, { - generateOutputLogs: flags.silent !== true, + const bunder = new Bundler(options, { + generateOutputLogs: flags.silent !== true, + }); + return bunder.process(); +}; + +run().then(() => { + return process.exit(0); }); -bunder.process();