Open gauntface opened 7 years ago
Could you do
documentation serve packages/*/index.mjs --require-extension mjs --parse-extension mjs
The gist of the answer is that documentation.js - at least so far - just uses the glob completion already available on your system, so including and excluding files follows whatever glob syntax is supported in bash/zsh/fish/ or whatever shell you're using.
@tmcw in your example, would I need to add multiple entries, one for packages/module-one/index.mjs
and one for packages/other-dir/example.mjs
?
To be honest I'm used to most tools like this having a JSON config file and supporting a glob pattern and set of ignore glob patterns.
So..is this not possible? I have all of my files in different folders at the root of the repo. When I run documentation on **/**/*.js
it fails because I believe its searching through node_modules too. Any way to exclude node_modules?
I've tried running it on sp-**/*.js
since all of my directories are prefixed with sp-
but this doesn't work either.
+1
In particular, I'm interested in excluding any node_modules
folders.
I've done this in the past, with jsdoc, in a .jsdoc file, like so:
"source": {
"include" : ["../projects"],
"includePattern": ".*src\\\\.+\\.js(doc|x)?$",
"excludePattern": "(node_modules|docs)"
}
The current solution for anyone looking into this from Google, is to use glob patterns. documentation.js uses the glob
npm package whose syntax can be found at https://github.com/isaacs/node-glob#glob-primer so in order to ignore for example node_modules
, you'd write something like:
npx documentation build '!(node_modules)/**/*.js' ...
Note that the pattern must be quoted to avoid any shell's native expansions and globbing
The relevant options passed to the glob function by documentation.js are:
{
nodir: true,
dot: true,
// ...
}
Hope this helps the people coming here from a Google search
can we have a config file for ex:
{
"plugins": [],
"recurseDepth": 10,
"source": {
"include": [".src/features/*"],
"includePattern": ".+\\.js(doc|x)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"sourceType": "module",
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc","closure"]
},
"templates": {
"cleverLinks": true,
"monospaceLinks": true
}
}
and that run as: documentation build -c jsdoc.config.json -f html -o docs
, this does not work for me! it just generates some empty docs
documentation.js doesn't use or support jsdoc configuration files - if you want to use them, you should use the jsdoc tool instead.
Our documentation is broken because we added moment.min.js
in our libs and we can't exclude the file from the scan, even using the yml
config file, there's no option for that.
'!(node_modules)/**/*.js'
Is this a guide ?
I have tried to exclude with glob pattern and it didn't help, despite the single quote.
On a project, we have fairly gnarly setup of multiple modules in a monorepo each can contain a
node_modules
andbuild
directory.By default I'd like to include all
.mjs
files in the docs and excludenode_modules
andbuild
directories.What is the best approach for including / excluding files for a package structure like?
At the moment I just got mjs building with:
Which is obviously including
build
andnode_modules