Programatic usage not working as expected
Summary
Trying to generate documentation using the programmatic approach described in the README file does not work as describe, instead throwing an error in the console.
Steps to reproduce
- Create a vuedoc.js file with the code provided as example in the README file;
- run
node vuedoc.js
; - notice the error in the console
Example Project
Please see this repo where I recreate the issue.
What is the current bug behavior?
Error: One of options.filename or options.filecontent is required
at Object.module.exports.parseOptions (/Users/work/Documents/projects/vuedoc-test/node_modules/@vuedoc/parser/index.js:31:11)
at Object.module.exports.parse (/Users/work/Documents/projects/vuedoc-test/node_modules/@vuedoc/parser/index.js:72:42)
at validator.then.then (/Users/work/Documents/projects/vuedoc-test/node_modules/@vuedoc/md/index.js:50:18)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
What is the expected correct behavior?
# HelloWorld
## Props
| Name | Type | Description |
| ----- | -------- | ----------- |
| `msg` | `String` | |
Possible fixes
I have found a temporary solution for this and added it here, however it will only work with one file at a time.
I have looked in the source code a bit, and noticed that the filenames
option is only taken into consideration with join
.
I think some options are:
- update the README.md file example with an example that works, possibly even one with
join
option set totrue
- update the project such that it looks at the given
filenames
and runs the parse method on each of them, only merging ifjoin
is set to true.
I will try getting a PR in with option 2, if it's ok with you!