From 2fc7273f68f6ec4e58e520d54a02fbdeb12e76bb Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 10 Mar 2015 18:10:41 -0700 Subject: [PATCH] Default to package main for documentation --- bin/documentation.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bin/documentation.js b/bin/documentation.js index 0c852ef..ef85a6f 100755 --- a/bin/documentation.js +++ b/bin/documentation.js @@ -2,15 +2,9 @@ var documentation = require('../'), JSONStream = require('JSONStream'), - argv = require('minimist')(process.argv.slice(2)); + argv = require('minimist')(process.argv.slice(2)), + path = require('path'); -/** - * A CLI utility that accepts a file path as input and emits a JSON - * array of parsed documentation headers - */ - -if (!argv._.length) throw new Error('usage: documentation [entry files]'); - -documentation(argv._[0]) +documentation(argv._[0] || require(path.resolve('package.json')).main) .pipe(JSONStream.stringify()) .pipe(process.stdout);