1.0.0 • Published 1 year ago

@fixedx/apifox-to-typescript v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

@fixedx/apifox-to-typescript

将ApiFox的接口转换为TypeScript接口

使用方法

1. 安装依赖

# 使用npm
npm install @fixedx/apifox-to-typescript

# 使用yarn
yarn add @fixedx/apifox-to-typescript

# 使用pnpm
pnpm install @fixedx/apifox-to-typescript

2. 创建配置文件

在项目根目录下的package.json配置以下内容:

// package.json
// ... 
"apifox": {
    "auth": {
      "account": "youraccount",
      "password": "yourpassword"
    },
    "projectId": "yourproject",
    "output": "src/apis", // 接口输出目录
    "requestMethodPath": "@/utils/request" // 请求方法目录, 需自行提供
}
// ...

3. 命令介绍

  • att create 命令

根据配置文件中的信息,从ApiFox获取接口信息,并生成对应的TypeScript接口文件。

npx att create
  • att lock命令

重新生成api.lock.json文件,用于锁定接口文件名。

npx att lock
1.0.0

1 year ago