@fixedx/apifox-to-typescript

1.0.3 • Public • Published

@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

Readme

Keywords

Package Sidebar

Install

npm i @fixedx/apifox-to-typescript

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

13.8 kB

Total Files

9

Last publish

Collaborators

  • fixedx