使用jsdoc-toolkit实现JS API文档自动化

在前面的博文中探讨自动化工程问题时,写过基于NodeJS的,使用gulp、grunt的jsdoc插件实现文档自动化。本文探讨基于java环境的自动化实现。

一、Java安装与环境配置

关于Java的安装与环境配置,可以参考博文YUI Compressor for Sublime text2

二、jsdoc-tookit下载与使用

下载链接:jsdoc-tookit,现在地址可能被墙了,可以通过搜索其它渠道下载。下面完成后,解压到工作目录即可。

 -> cmd -> 命令行窗口

-> cd到jsdoc-toolkit所在目录(我的是G:\Workspace\jsdoc-toolkit)

-> windows:java -jar jsrun.jar app\run.js -a -t=templates\jsdoc myTest/myTest.js

     Linux:$ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc myTest/myTest.js

-> 运行后生成out(默认)目录

-> 完成自动化API文档。

 当然myTest.js文件中的注释需要符合jsDoc规范。 如果我们不想使用默认目录out,可以通过-d命令来设置。

 

jsdoc-toolkit相关命令参考:

G:\Workspace\jsdoc-toolkit>java -jar jsrun.jar app\run.js --help
USAGE: java -jar jsrun.jar app/run.js [OPTIONS] <SRC_DIR> <SRC_FILE> ...

OPTIONS:
  -a or --allfunctions
          Include all functions, even undocumented ones.

  -c or --conf
          Load a configuration file.

  -d=<PATH> or --directory=<PATH>
          Output to this directory (defaults to "out").

  -D="myVar:My value" or --define="myVar:My value"
          Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.myVar.

  -e=<ENCODING> or --encoding=<ENCODING>
          Use this encoding to read and write files.

  -E="REGEX" or --exclude="REGEX"
          Multiple. Exclude files based on the supplied regex.

  -h or --help
          Show this message and exit.

  -n or --nocode
          Ignore all code, only document comments with @name tags.

  -o=<PATH> or --out=<PATH>
          Print log messages to a file (defaults to stdout).

  -p or --private
          Include symbols tagged as private, underscored and inner symbols.

  -q or --quiet
          Do not output any messages, not even warnings.

  -r=<DEPTH> or --recurse=<DEPTH>
          Descend into src directories.

  -s or --suppress
          Suppress source code output.

  -S or --securemodules
          Use Secure Modules mode to parse source code.

  -t=<PATH> or --template=<PATH>
          Required. Use this template to format the output.

  -T or --test
          Run all unit tests and exit.

  -u or --unique
          Force file names to be unique, but not based on symbol names.

  -v or --verbose
          Provide verbose feedback about what is happening.

  -x=<EXT>[,EXT]... or --ext=<EXT>[,EXT]...
          Scan source files with the given extension/s (defaults to js).


转载声明:

本文标题:使用jsdoc-toolkit实现JS API文档自动化

本文链接:http://www.zuojj.com/archives/1064.html,转载请注明转自Benjamin-专注前端开发和用户体验

转载于:https://www.cnblogs.com/cuew1987/p/4090052.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值