1.4.3 • Published 6 months ago

auto-api-ts v1.4.3

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

AUTO API TS

Description

自动将swagger接口转换为ts类型

This is a simple tool to generate typescript interfaces from a json schema

Installation

npm install -g auto-api-ts

Use in Scripts

项目根目录下新建.env文件

# swagger地址
BASE_URL="https://api.xxx.dev"
# swagger版本(可选)
API_VERSION="/api/v1/xxx/api-docs"
# swagger请求头
COOKIE="xxx"
# 生成的文件夹路径
OUTPUT="./apis"
# 请求方法的导入路径
IMPORT="import { request } from '@/request'"
# api前缀
PREFIX="/api/v1"
# api名称压缩等级 'none' | 'normal' | 'highest'
MINIFY_API_NAME="highest"

package.json中添加脚本

{
  "scripts": {
    "api": "auto-api-ts"
  }
}

运行脚本

npm run api

Use in typescript

import { build } 'auto-api-ts';

build({
  BASE_URL: `https://api.xxx.dev`,
  COOKIE: `xxx`,
  OUTPUT: `./apis`,
  IMPORT: `import { request } from '@/request'`,
  PREFIX: `/api/v1`,
  MINIFY_API_NAME: `highest`,
});
1.2.0

10 months ago

1.2.6

9 months ago

1.4.3

6 months ago

1.2.5

9 months ago

1.4.2

9 months ago

1.2.4

9 months ago

1.4.1

9 months ago

1.2.3

10 months ago

1.4.0

9 months ago

1.3.1

9 months ago

1.2.2

10 months ago

1.3.0

9 months ago

1.2.1

10 months ago

1.1.12

10 months ago

1.1.11

10 months ago

1.1.10

10 months ago

1.1.14

10 months ago

1.1.13

10 months ago

1.1.9

10 months ago

1.1.8

10 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago