Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions bin/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,19 @@ function parseArgs() {
options.access = (options.access || ['public', 'undefined', 'protected']).concat(['private']);
}

if (inputs.length == 0) {
try {
var p = require(path.resolve('package.json'));
options.package = p;
try {
var p = require(path.resolve('package.json'));
options.package = p;
if (inputs.length == 0) {
inputs = [p.main || 'index.js'];
} catch (e) {
yargs.showHelp();
throw new Error('documentation was given no files and was not run in a module directory');
}
} catch (e) {
// Continue regardless of error
}

if (inputs.length == 0) {
yargs.showHelp();
throw new Error('documentation was given no files and was not run in a module directory');
}

return {
Expand Down