Skip to content
This repository was archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Don't set up yargs unless main module
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Mar 29, 2016
1 parent 31fe7f2 commit 1a5746f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ const yargs = require('yargs')
.alias('h', 'help')
.epilog('Copyright 2015');

const argv = yargs.argv;
if (process.mainModule === module) {
const argv = yargs.argv;

if (!argv._ || argv._.length < 1) {
yargs.showHelp();
process.exit(-1);
}
if (!argv._ || argv._.length < 1) {
yargs.showHelp();
process.exit(-1);
}

const sourceDirs = argv._;
const appDir = argv.a;
const sourceDirs = argv._;
const appDir = argv.a;

if (process.mainModule === module) {
main(appDir, sourceDirs)
.then(() => process.exit(0))
.catch((e) => {
Expand Down

0 comments on commit 1a5746f

Please sign in to comment.