如何包括和排除目录与documentationjs解析

问题描述 投票:1回答:1

特别是,我感兴趣的是排除任何node_modules文件夹,但也有其他需要被排除在外。

这通常是完成在配置文件;例如,一个文件.jsdoc,像这样:

"source": {
    "include" : ["../projects"],
    "includePattern": ".*src\\\\.+\\.js(doc|x)?$",
    "excludePattern": "(node_modules|docs)"
}
documentation glob jsdoc documentation-generation documentationjs
1个回答
1
投票

为我工作的最好办法是注释我与@public @private等文档,然后通过选择--access: ['public', 'private']选择性地包括我想要的作品。

作为比肩documentation

--access, -a  Include only comments with a given access level, 
              out of private, protected, public, undefined. By
              default, public, protected, and undefined access
              levels are included
[array] [choices: "public", "private", "protected", "undefined"]

你可以写一个脚本以编程方式生成的文档

documentation
    .build('src/index.js', { access: ["public"] })
    .then(documentation.formats.md)
    .then(markdown => {
      fs.writeFileSync('README.md'), markdown);
    })
    .catch(error => console.error(error));

编辑:

只要是明确的,这里是如何利用控制台命令 -

documentation build ./src/index.js --access private public protected -f html -o docs
© www.soinside.com 2019 - 2024. All rights reserved.