Skip to content

Commit

Permalink
If options.configure is passed, neither .files nor .source are mandat…
Browse files Browse the repository at this point in the history
…ory. #27
  • Loading branch information
75lb committed Aug 25, 2024
1 parent baf0551 commit f571b08
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/explain.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ util.inspect.defaultOptions.depth = 6
util.inspect.defaultOptions.breakLength = process.stdout.columns
util.inspect.defaultOptions.maxArrayLength = Infinity

const data = await jsdoc.explain({ files: process.argv.slice(2), cache: true, pedantic: true })
const data = await jsdoc.explain({ files: process.argv.slice(2), cache: true })
console.log(data)
8 changes: 8 additions & 0 deletions example/using-config-explain.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import jsdoc from 'jsdoc-api'
import util from 'node:util'
util.inspect.defaultOptions.depth = 6
util.inspect.defaultOptions.breakLength = process.stdout.columns
util.inspect.defaultOptions.maxArrayLength = Infinity

const data = await jsdoc.explain({ cache: true, configure: './example/using-config.json' })
console.log(data)
4 changes: 4 additions & 0 deletions example/using-config-input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* A documented function.
*/
function something () {}
3 changes: 3 additions & 0 deletions example/using-config-render.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import jsdoc from 'jsdoc-api'

await jsdoc.render({ configure: './example/using-config.json' })
8 changes: 8 additions & 0 deletions example/using-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"source": {
"include": [ "example/using-config-input.js" ]
},
"opts": {
"destination": "./config-out/"
}
}
4 changes: 2 additions & 2 deletions lib/jsdoc-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const { __dirname } = currentModulePaths(import.meta.url)
class JsdocCommand {
constructor (options = {}, cache) {
assert.ok(
options.files?.length || options.source,
'Must set either .files or .source'
options.files?.length || options.source || options.configure,
'Must set at least one of .files, .source or .configure'
)
options.files = arrayify(options.files)

Expand Down

0 comments on commit f571b08

Please sign in to comment.