# createDOC

> 一款自动化生成文档工具

Latest version **1.0.19** (published 2016-09-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install createDOC
pnpm add createDOC
yarn add createDOC
bun add createDOC
```

Provides the command `createDOC`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.19 |
| Published | 2016-09-26 |
| First published | 2016-08-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | smart sweet |
| Maintainers | a1511870876 |
| Keywords | doc, 自动化文档, 文档 |

## Links

- npm: https://www.npmjs.com/package/createDOC
- Repository: https://github.com/threerocks/buildDOC
- Homepage: https://github.com/threerocks/buildDOC#readme
- Issues: https://github.com/threerocks/buildDOC/issues
- npm.io page: https://npm.io/package/createDOC

## Dependencies (8)

- [co](https://npm.io/package/co.md) ^4.6.0
- [dox](https://npm.io/package/dox.md) ^0.9.0
- [colors](https://npm.io/package/colors.md) ^1.1.2
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [bluebird](https://npm.io/package/bluebird.md) ^3.4.1
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.5
- [linebyline](https://npm.io/package/linebyline.md) ^1.3.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 1.0.19 (latest) — 2016-09-26
- 1.0.17 — 2016-09-18
- 1.0.16 — 2016-08-30
- 1.0.15 — 2016-08-30
- 1.0.14 — 2016-08-30
- 1.0.13 — 2016-08-22
- 1.0.12 — 2016-08-17
- 1.0.11 — 2016-08-17
- 1.0.10 — 2016-08-17
- 1.0.9 — 2016-08-17
- 1.0.8 — 2016-08-17
- 1.0.7 — 2016-08-17
- 1.0.6 — 2016-08-17
- 1.0.5 — 2016-08-17
- 1.0.4 — 2016-08-17
- … 4 more at https://npm.io/package/createDOC/versions

## README

一款自动化生成文档工具

## 简介

工具可以自动化生成数据库和API接口的markdown文档，并通过修改git hooks，使项目的每次commit都会自动更新文档。

## 安装

 `npm i createDOC -g`

## 配置
 - 在项目根目录使用`createDOC init`命令初始化，该命令会在当前目录创建`doc.json`文件。
 - 生成`doc.json`文件后，需要详细配置数据库schemas存储路径(目前只支持关系型数据库)，以及路由控制文件，以及子路由目录。
 - API注释规则，遵循TJ大神dox规范，简化版规则如下

 ```js
 /**
 * API description
 *
 * @param {type} name/name=default_value description 
 * @return {String} description
 * @example
 *     any example
 *     
 * @other description
 */
 ```

*ps: 此工具为内部使用工具，如个人使用可下载源码，做简单修改即可*
## 使用

```sh
  Usage: createDOC [options] [command]

  Commands:

    init         初始化当前目录doc.json文件
    show         显示配置文件状态
    run          启动程序
    modifyhook   修改项目下的hook文件
    *

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

  Examples:

    $ createDOC --help
    $ createDOC -h
    $ createDOC show
```

## 示例说明
doc.json示例

```json
{
    "db": {
        "schemas": "/Users/mac/Desktop/testssss/schemas",
        "markdown": {
            "path": "/Users/mac/Desktop/testssss/doc1/",
            "file": "db.md"
        }
    },
    "api": {
        "controller": "/Users/mac/Desktop/testssss",
        "routes": "/Users/mac/Desktop/testssss",
        "markdown": {
            "path": "/Users/mac/Desktop/testssss/doc1",
            "file": "api.md"
        }
    }
}
```
schema.js示例

```js
module.exports = function(sequelize, DataTypes) {
   	return sequelize.define('test_zk_absence', {
   		//这是id
   		id: {
   			type: DataTypes.INTEGER,
   			allowNull: false,
   			primaryKey: true,
   			autoIncrement: true
   		},
   		//这是end_data
   		end_date: {
   			type: DataTypes.DATE,
   			allowNull: true
   		},
   		/*
   		{
   			a:1,
   			b:2,
   			c:{a:2},
   			d:'2222'
   		}
   		*/
   		type_id: {
   			type: DataTypes.INTEGER,
   			allowNull: true
   		},
   		updated_at: {
   			type: DataTypes.DATE,
   			allowNull: false
   		}
   	}, {
   		tableName: 'test_zk_absence'
   	});
   };
```
api注释示例

```js
/**
   * 获取多个课程
   * @param {Number} examinationId 考试类型
   * @param {Number} subjectId 科目类型
   * @param {Number} statusId=3 状态类型
   * @param {String} startDate 更新开始时间
   * @param {String} endDate 更新结束时间
   * @param {String} keyword 关键词
   * @param {Number} page 页码
   * @return {Array} ok
   * @example [1,2,3,3,4]
   */
getCourses(req, params) {
		... ...
}
```
## TODO
1. 代码逻辑优化，适应力更强。
2. 代码速度、质量优化。
3. 加入单元测试

[github地址](https://github.com/threerocks/buildDOC)

---
_Source: https://npm.io/package/createDOC · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
