Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
zekth committed Jan 29, 2020
1 parent c5c2888 commit 0acebb7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ if (!program.color) {
const log = require('../lib/log');
const output = require('../lib/output');
const madge = require('../lib/api');
const config = Object.assign(rc, getPackageConfig());

let packageConfig = {};
try {
packageConfig = require(path.join(process.cwd(), 'package.json')).madge;
} catch (e) { }
const config = Object.assign(rc, packageConfig);

program.options.forEach((opt) => {
const name = opt.name();
Expand Down Expand Up @@ -132,14 +137,6 @@ function dependencyFilter() {
};
}

function getPackageConfig() {
try {
return require(path.join(process.cwd(), 'package.json')).madge;
} catch (err) {
return {};
}
}

new Promise((resolve, reject) => {
if (program.stdin) {
let buffer = '';
Expand Down

0 comments on commit 0acebb7

Please sign in to comment.