Skip to content

esdoc/esdoc-importpath-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Document

ESDoc Import Path Plugin

This is a plugin that converts the import path. ESDoc displays the import path of class/function to the document. However, because usually ES6 is transpiled to npm publish, different import path.

For example, src/MyClass.js will be referred to as in the ESDoc document import MyClass from 'my-module/src/MyClass.js'. However, in practice it is different from the import path when you use because it is transpiled (for example, import MyClass from 'my-module/lib/MyClass.js').

Therefore, convert the import path by using following setting.

{ "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-importpath-plugin", "option": { "replaces": [ {"from": "^src/", "to": "lib/"} ] } } ] }

from is regular expression and tois letter. In the internal from and to are used with String#replace(new RegExp (from), to).

Also, when writing multi rules, it will also be carried out transformation many times. For example, [{from: "^src/", to: "lib/"}, {from: "MyFooClass", to: "my-foo"}] converted as follows:

  • my-module/src/MyFooClass.js => my-module/lib/MyFooClass.js => my-module/lib/my-foo

Install and Usage

npm install -g esdoc-importpath-plugin

setup plugin property in esdoc.json

{ "source": "./src", "destination": "./doc", "plugins": [ { "name": "esdoc-importpath-plugin", "option": { "replaces": [ {"from": "^src/", "to": "lib"} ] } } ] }

execute ESDoc

esdoc -c esdoc.json

LICENSE

MIT

Ryo Maruyama@h13i32maru

About

[deprecated] Import Path Plugin for ESDoc

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •