0.1.2 • Published 4 months ago

@lough/docs-cli v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

@lough/docs-cli

This is a Docs tool docked in lough.

一款集成了 TypeScriptJSDoc 的强大文档生成工具,旨在简化创建和维护项目文档的过程。

Feature

  • 基于 TypeScript:直接使用 TypeScript 源文件,利用 TypeScript 强大的类型系统,为文档提供准确而丰富的信息。
  • 自动生成 API 文档:从 TypeScript 代码和 JSDoc 注释自动生成 API 文档,包括类、接口、函数等。
  • 命令行界面 (CLI):提供简单直观的 CLI,轻松生成文档。
  • 支持 Markdown:生成的文档为 Markdown 格式,方便与各种版本控制平台和文档工具集成。

Install

全局安装

npm install @lough/docs-cli -g

局部安装

npm install @lough/docs-cli -D

CMD

Command

lough-docs [options] [command]

generate docs by typescript.

options:

  • "-t, --type [string...]", "generate type: Array<api | cmd>", string[]
  • "-i, --input [string]", "generate file input directory or typescript file, if type is api default is tsconfig input, else default is src/commands."
  • "-o, --output [string]", "generate file output directory or markdown file, default is README.md."
  • "-q, --quite [boolean]", "execute the program silently.", false

action: (options: GenerateOptions) => Promise<void>

init

init lough-docs in project.

options:

  • "-pt, --projectType [string]", "classLib | componentLib | nodeClassLib | cli, if quite is true, default isclassLib."
  • "-q, --quite [boolean]", "execute the program silently.", false

action: (options: InitOptions) => Promise<void>

Interface

InitOptions 初始化选项

members

属性说明类型
projectType项目类型 如果为静默模式,默认为类库 classLibPROJECT_TYPE
quite静默 是否开启静默模式boolean

GenerateOptions 生成选项

members

属性说明类型
type生成类型GENERATE_TYPE[]
input入口文件或目录 相对于 process.cwd()string
output输出文件或目录 相对于 process.cwd()string
quite静默 是否开启静默模式boolean

API

Class

GenerateFlow 生成流

parameters

属性说明必传类型默认值
parameters-GenerateFlowParameters-

returns: GenerateFlow

members

属性说明类型标记
parse解析文件() => AllDeclaration[]
make制作文档(declarationList: AllDeclaration[]) => string
save保存文件(markdown: string) => void
pipeline流水线() => void

InitFlow 初始化流

parameters

属性说明必传类型默认值
parameters-InitFlowParameters-

returns: InitFlow

members

属性说明类型标记
install安装() => void
configure配置() => void
pipeline流水线() => void

Enum

GENERATE_TYPE 生成类型

members

属性说明
'api'API文档'api'
'cmd'命令文档'cmd'

PROJECT_TYPE 项目类型

members

属性说明
classLib类库'classLib'
componentLib组件库'componentLib'
nodeClassLibNode 类库'nodeClassLib'
cli脚手架'cli'

Interface

GenerateFlowLifeCycle 生成流生命周期

members

属性说明类型
parse解析开始() => any
parsing解析中(filePath: string) => any
parsed解析结束() => any
make制作开始() => any
made制作结束() => any
save保存结束() => any
saved保存开始(filePath: string) => any

GenerateFlowParameters 生成流参数

members

属性说明类型
type生成类型GENERATE_TYPE
input入口文件或目录 完整路径string
output输出目录 完整路径string
cycle生命周期GenerateFlowLifeCycle

InitFlowLifeCycle 初始化流生命周期

members

属性说明类型
install安装开始() => any
installed安装结束() => any
configure配置开始() => any
configured配置结束() => any

InitFlowParameters 初始化流参数

members

属性说明类型
projectType项目类型PROJECT_TYPE
cycle生命周期InitFlowLifeCycle