Skip to content

Commit b26d465

Browse files
committed
added --conf option to pass jsdoc config. Fixes #3 and jsdoc2md/jsdoc-to-markdown#45
1 parent 18541e6 commit b26d465

5 files changed

Lines changed: 18 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ For use within your node.js app.
213213
$ npm install jsdoc-parse --save
214214
```
215215

216-
##API Reference
216+
## API Reference
217217
Exports a single function to parse jsdoc data.
218218

219219
**Example**

jsdoc2md/README.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ For use within your node.js app.
213213
$ npm install jsdoc-parse --save
214214
```
215215

216-
##API Reference
216+
## API Reference
217217
{{#module name="jsdoc-parse"~}}
218218
{{>body~}}
219219
{{>member-index~}}

lib/cli-options.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ exports.definitions = [
2020
type: Boolean,
2121
description: 'Enable experimental parsing of .html files'
2222
},
23+
{
24+
name: 'conf',
25+
type: String,
26+
typeLabel: '[underline]{file}',
27+
description: 'Jsdoc config file.'
28+
},
2329
{
2430
name: 'sort-by',
2531
type: String,

lib/jsdoc-parse.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var fs = require('fs')
88
var mfs = require('more-fs')
99
var fileSet = require('file-set')
1010
var Transform = require('stream').Transform
11-
var walkBack = require('walk-back')
1211
var cliOptions = require('./cli-options')
1312

1413
/**
@@ -151,7 +150,7 @@ function OutputTransform (options) {
151150
this._flush = function () {
152151
try {
153152
this.json = applyOptions(this.json, options)
154-
} catch(err) {
153+
} catch (err) {
155154
err.message += ' [Problem parsing the JSON data output by jsdoc, input data: ' + this.json.toString().substr(0, 100) + ']'
156155
return this.emit('error', err)
157156
}
@@ -168,20 +167,22 @@ Uses `publish.js` as a template and the [`plugins/parseHtml`](https://github.com
168167
*/
169168
function getJsdocOutput (src, options, done) {
170169
var jsdocTemplatePath = path.resolve(__dirname, '..', 'lib')
171-
var jsdocPath = walkBack(
172-
path.join(__dirname, '..'),
173-
path.join('node_modules', 'jsdoc-75lb', 'jsdoc.js')
174-
)
170+
var jsdocPath = path.resolve(__dirname, '../node_modules/.bin/jsdoc')
175171

176-
if (!jsdocPath) {
177-
throw Error('jsdoc-parse: cannot find jsdoc')
172+
if (!fs.existsSync(jsdocPath)) {
173+
throw Error('jsdoc-parse: cannot find jsdoc: ' + jsdocPath)
178174
}
179175
var args = [ jsdocPath, '--pedantic', '-t', jsdocTemplatePath ]
180176
if (options.html) {
181177
args = args.concat([
182178
'-c',
183179
path.resolve(__dirname, 'conf.json')
184180
])
181+
} else if (options.conf) {
182+
args = args.concat([
183+
'-c',
184+
path.resolve(options.conf)
185+
])
185186
}
186187
args = args.concat(src)
187188

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"file-set": "~0.2.1",
3030
"jsdoc-75lb": "^3.4.1",
3131
"more-fs": "~0.5.0",
32-
"object-tools": "^2",
33-
"walk-back": "^1"
32+
"object-tools": "^2"
3433
},
3534
"devDependencies": {
3635
"tape": "^4"

0 commit comments

Comments
 (0)