0.2.0 • Published 5 years ago

koact-doc-to-definition v0.2.0

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

koact-doc-to-definition

NPM version

怎么使用?

使用npmyarn全局安装koact-doc-to-definition

在项目根目录下创建配置文件koact-api-generator.config.json

{
  "url": "http://localhost:3000",
  "destination": "test/apis/axios",
  "docSecret": "123456",
  "target": "axios",
  "pattern": [
    "**",
    "!/ms/*"
  ]
}

注意:destination配置是相对于命令执行目录的地址

// 配置文件数据结构
export interface IOptions {
  url: string; // 使用了`koact`作为路由组件的`koa`服务器地址;
  destination: string; // 希望API文件存放的文件夹地址;
  docSecret?: string; // koact doc密钥(如果服务端设置了);
  target?: 'axios' | 'msio'; // 要生成的接口文件类型;
  pattern?: string | string[]; // 接口过滤规则
}

接口过滤规则的配置参考multimatch

在项目目录下执行koact-doc-to-definition指令即可。

可使用--config [config-file-path]来指定配置文件的地址,默认为koact-api-generator.config.json

多个服务出口的情况

可以将koact-api-generator.config.json配置为IOptions[]的格式即可。

0.2.0

5 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago