Skip to content

Commit 9753f54

Browse files
committed
Parse package.json even if input files are given
Resolves documentationjs#405
1 parent ade4f34 commit 9753f54

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

bin/documentation.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,19 @@ function parseArgs() {
4646
options.access = (options.access || ['public', 'undefined', 'protected']).concat(['private']);
4747
}
4848

49-
if (inputs.length == 0) {
50-
try {
51-
var p = require(path.resolve('package.json'));
52-
options.package = p;
49+
try {
50+
var p = require(path.resolve('package.json'));
51+
options.package = p;
52+
if (inputs.length == 0) {
5353
inputs = [p.main || 'index.js'];
54-
} catch (e) {
55-
yargs.showHelp();
56-
throw new Error('documentation was given no files and was not run in a module directory');
5754
}
55+
} catch (e) {
56+
57+
}
58+
59+
if (inputs.length == 0) {
60+
yargs.showHelp();
61+
throw new Error('documentation was given no files and was not run in a module directory');
5862
}
5963

6064
return {

0 commit comments

Comments
 (0)