Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse package.json even if input files are given #406

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
Parse package.json even if input files are given
Resolves #405
  • Loading branch information
kripod committed Apr 25, 2016
commit 9753f54db526ce997ed7a833f5f84fb591ad08fd
18 changes: 11 additions & 7 deletions bin/documentation.js
Original file line number Diff line number Diff line change
@@ -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) {

}

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

return {