From 9753f54db526ce997ed7a833f5f84fb591ad08fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Poduszl=C3=B3?= Date: Mon, 25 Apr 2016 21:01:38 +0200 Subject: [PATCH 1/2] Parse package.json even if input files are given Resolves #405 --- bin/documentation.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bin/documentation.js b/bin/documentation.js index 3f8995a0d..f0f8bf439 100755 --- a/bin/documentation.js +++ b/bin/documentation.js @@ -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 { From 3d9f977e7b9b72e5e94580cadb9b93e803365564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Poduszl=C3=B3?= Date: Mon, 25 Apr 2016 21:16:24 +0200 Subject: [PATCH 2/2] Fixed a linting issue --- bin/documentation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/documentation.js b/bin/documentation.js index f0f8bf439..370bc2748 100755 --- a/bin/documentation.js +++ b/bin/documentation.js @@ -53,7 +53,7 @@ function parseArgs() { inputs = [p.main || 'index.js']; } } catch (e) { - + // Continue regardless of error } if (inputs.length == 0) {