Skip to content

Commit f571b08

Browse files
committed
If options.configure is passed, neither .files nor .source are mandatory. #27
1 parent baf0551 commit f571b08

File tree

6 files changed

+26
-3
lines changed

6 files changed

+26
-3
lines changed

example/explain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ util.inspect.defaultOptions.depth = 6
44
util.inspect.defaultOptions.breakLength = process.stdout.columns
55
util.inspect.defaultOptions.maxArrayLength = Infinity
66

7-
const data = await jsdoc.explain({ files: process.argv.slice(2), cache: true, pedantic: true })
7+
const data = await jsdoc.explain({ files: process.argv.slice(2), cache: true })
88
console.log(data)

example/using-config-explain.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import jsdoc from 'jsdoc-api'
2+
import util from 'node:util'
3+
util.inspect.defaultOptions.depth = 6
4+
util.inspect.defaultOptions.breakLength = process.stdout.columns
5+
util.inspect.defaultOptions.maxArrayLength = Infinity
6+
7+
const data = await jsdoc.explain({ cache: true, configure: './example/using-config.json' })
8+
console.log(data)

example/using-config-input.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* A documented function.
3+
*/
4+
function something () {}

example/using-config-render.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import jsdoc from 'jsdoc-api'
2+
3+
await jsdoc.render({ configure: './example/using-config.json' })

example/using-config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"source": {
3+
"include": [ "example/using-config-input.js" ]
4+
},
5+
"opts": {
6+
"destination": "./config-out/"
7+
}
8+
}

lib/jsdoc-command.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const { __dirname } = currentModulePaths(import.meta.url)
1212
class JsdocCommand {
1313
constructor (options = {}, cache) {
1414
assert.ok(
15-
options.files?.length || options.source,
16-
'Must set either .files or .source'
15+
options.files?.length || options.source || options.configure,
16+
'Must set at least one of .files, .source or .configure'
1717
)
1818
options.files = arrayify(options.files)
1919

0 commit comments

Comments
 (0)