Skip to content

Commit

Permalink
docs: update document
Browse files Browse the repository at this point in the history
  • Loading branch information
gogoyqj committed Apr 4, 2023
1 parent e2df6fe commit db29abc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ module.exports = {
describe: 'readonly',
it: 'readonly',
jest: 'readonly',
expect: 'readonly'
expect: 'readonly',
afterAll: 'readonly',
beforeAll: 'readonly',
// ts
},
rules: {
Expand Down
11 changes: 11 additions & 0 deletions GettingStarted.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
```
$ npm i -D auto-service
$ npx autos --help
$ npx autos --init # 快速的创建`json2service.js`配置文件:
```

## 2. 参数配置
Expand All @@ -46,6 +47,16 @@ $ npx autos --help

Autos 默认从当前目录下的 json2service.json 文件读取主配置,我们也可以通过命令行参数 `-c, --config` 指定任意格式为 JSON 或者 JavaScript 的配置文件。

我们可以使用`npx autos --init`命令快速的创建一个`json2service.js`配置文件:

```shell
npx autos --init
prompt: 请选择接口文档类型 type,yapi 或者 swagger:
prompt: 请输入接口文档源地址 remoteUrl,例如 https://yapi.com/api.json:
prompt: 请输入接口文档本地存储地址 url,例如:./swagger.json:
prompt: 请输入 service 代码输出目录 -o,例如: src/services:
```

配置文件必须导出一个对象,包含以下可配置属性:

<Props of={IJSON2Service} />
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "auto-service",
"version": "4.0.4",
"version": "4.0.5",
"description": "auto generate swagger or yapi mock to typescript services and models",
"repository": "[email protected]:gogoyqj/auto-service.git",
"author": "杨乾军 <yang@yang>",
"author": "yangqianjun <yang@yang>",
"license": "MIT",
"main": "lib/index.js",
"bin": {
Expand Down
8 changes: 4 additions & 4 deletions src/initConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export default function initConfig(ConfigFile: string) {
fs.writeFileSync(
ConfigFile,
`/**
* @typedef { import("auto-service/lib/consts").JSON2Service } JSON2Service
* @type {JSON2Service} 配置
*/
module.exports = ${JSON.stringify(defaultConfigJSON, null, 2)}`,
* @typedef { import("auto-service/lib/consts").JSON2Service } JSON2Service
* @type {JSON2Service} 配置
*/
module.exports = ${JSON.stringify(defaultConfigJSON, null, 2)}`,
{
encoding: 'utf8'
}
Expand Down

0 comments on commit db29abc

Please sign in to comment.