返回介绍

Config

发布于 2019-06-04 22:32:16 字数 8443 浏览 1002 评论 0 收藏 0

Introduce config files of ESDoc with esdoc-standard-plugin.

Minimum Config

{
  "source": "./src",
  "destination": "./docs",
  "plugins": [{"name": "esdoc-standard-plugin"}]
}

Integrate Test Codes Config

{
  "source": "./src",
  "destination": "./docs",
  "plugins": [
  {
    "name": "esdoc-standard-plugin",
    "option": {
      "test": {
        "source": "./test/",
        "interfaces": ["describe", "it", "context", "suite", "test"],
        "includes": ["(spec|Spec|test|Test)\\.js$"],
        "excludes": ["\\.config\\.js$"]
      }
    }
  }]
}

And if use @test, more better integration.

/** @test {MyClass} */
describe('MyClass has foo bar feature', ()=>{

  /** @test {MyClass#baz} */
  it('MyClass#baz returns magic value', ()=>{
    assert(true);
  });
});

Integrate Manual Config

{
  "source": "./src",
  "destination": "./docs",
  "plugins": [
  {
    "name": "esdoc-standard-plugin",
    "option": {
      "manual": {
        "index": "./manual/index.md",
        "asset": "./manual/asset",
        "files": [
          "./manual/overview.md",
          "./manual/installation.md",
          "./manual/usage.md",
          "./manual/tutorial.md",
          "./manual/configuration.md",
          "./manual/example.md",
          "./CHANGELOG.md"
        ]
      }
    }
  }]
}

Full Config

{
  "source": "./src",
  "destination": "./docs",
  "includes": ["\\.js$"],
  "excludes": ["\\.config\\.js$"],
  "plugins": [
  {
    "name": "esdoc-standard-plugin",
    "option": {
      "lint": {"enable": true},
      "coverage": {"enable": true},
      "accessor": {"access": ["public", "protected", "private"], "autoPrivate": true},
      "undocumentIdentifier": {"enable": true},
      "unexportedIdentifier": {"enable": false},
      "typeInference": {"enable": true},
      "brand": {
        "logo": "./logo.png",
        "title": "My Library",
        "description": "this is awesome library",
        "repository": "https://github.com/foo/bar",
        "site": "http://my-library.org",
        "author": "https://twitter.com/foo",
        "image": "http://my-library.org/logo.png"
      },
      "manual": {
        "index": "./manual/index.md",
        "globalIndex": true,
        "asset": "./manual/asset",
        "files": [
          "./manual/overview.md"
        ]
      },
      "test": {
        "source": "./test/",
        "interfaces": ["describe", "it", "context", "suite", "test"],
        "includes": ["(spec|Spec|test|Test)\\.js$"],
        "excludes": ["\\.config\\.js$"]
      }
    }
  }] 
}

ESDoc Config

Name Required Default Description
source true - JavaScript source codes directory path.
destination true - Output directory path.
includes - ["\\.js$"] Process files that are matched with the regexp at any one.
excludes - ["\\.config\\.js$"] Not process files that are matched with the regexp at any one.
index - ./README.md Includes file into index page of document
package - ./package.json Use package.json info.
outputAST - true If specified false, does not generate AST files.
plugins - null If specified, use each plugins. To see Plugin Feature for more information.
plugins[].name true - Plugin module name(e.g. your-awesome-plugin) or plugin file path(e.g. ./your-awesome-plugin.js).
plugins[].option - null If specified, the plugin get the option.

esdoc-standard-plugin Option

Name Required Default Description
lint.enable - true If specified, execute documentation lint.
coverage.enable - true If true, output document coverage.
accessor.access - ["public", "protected", "private""] Process only identifiers(class, method, etc...) that are have the access(public, protected and private).
accessor.autoPrivate - true Deal with identifiers beginning with "_" as a private.
e.g. this._foo is private. but /** @public */ this._foo is public.
undocumentIdentifier.enable - true If true, also process undocument Identifiers.
e.g. /** @foo bar */ class MyClass is document identifier, class MyClass is undocument identifier.
unexportIdentifier.enable - false If true, also process unexported Identifiers.
e.g. export class MyClass is exported, class MyClass is not exported.
typeInference.true - true If true, infer type of variable, return value.
brand.logo - - aaa
brand.title - - Use title for output.
brand.description - - If specified, write meta tag, og tag and twitter card.
brand.repository - - If specified, write URL in header navigation.
brand.site - - If specified, write og tag and twitter card.
brand.author - - If specified, write og tag and twitter card.
brand.image - - If specified, write og tag and twitter card.
manual.globalIndex - false If specify true, ESDoc generates global index using the manual. In other words, it means to replace config.index to config.manual.index
manual.index - null If specify markdown file, show manual index using the file.
manual.asset - null if specify asset(image) directory path, include the directory into manual.
manual.files - null If specify markdown files, include manual into output.
test.source true - Test codes directory path.
test.interfaces ["describe", "it", "context", "suite", "test"] Test code interfaces.
test.includes - ["(spec|Spec|test|Test)\\.js$"] Process files that are matched with the regexp at any one.
test.excludes - ["\\.config\\.js$"] Not process files that are matched with the regexp at any one.

Note: A file path in config is based on current directory.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文