1.0.1-beta.1 • Published 2 years ago

ytt-apis v1.0.1-beta.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

目录说明

  1. generator-apis 核心代码块,根据 token 读写 yapi 中的数据
  2. src/tools/* 公共方法
  3. src/ytt/* 存放的 api
  4. src/index.ts tools 和 ytt 的入口函数

配置文件说明

  1. token.config.js 此文件输入迭代项目的 token, 由 core/generator 调用
  2. ytt.config.ts 公共配置,勿动, 由 core/generator 调用
  3. createEntry.js 动态生成 ytt 及 tools 所有文件的入口函数

API 命名规则

  1. 请求函数命名规则
  • path + method
  1. 入参 Interface 命名规则
  • path + method + Request
  1. 回参 Interface 命名规则
  • path + method + Response
  1. 举例说明
  • api 地址: /api/charging/charging-station/edit
  • 请求函数名称: apiChargingChargingStationEditPut
  • 入参 Interface: ChargingChargingStationEditPutRequest
  • 回参 interface: ChargingChargingStationEditPutResponse

如何 mock 数据

 apiChargingChargingStationEditPut(data: ChargingChargingStationEditPutRequest, {server: 'mock'})

scripts 脚本说明

  1. createApi 自动生成 ts 文件
  2. read 根据生成的 ts 文件, 生成入口文件
  3. build:es 根据入口文件, 打包生成 es 文件到 dist
  4. update:version 更新 package.json 文件版本,并提交到 remote
  5. prepublish 发布版本到 npm 仓库

发版

  1. 开发阶段避免不了接口文档频繁更新, 总体原则: 保证版本清爽, 使用 beta 更新

  2. 直接执行npm run build:publish

  3. 迭代封版后 npm version minor

其它

  • 更改 package.json npm version prerelease --preid=beta -m '版本更新至%s'
    • 0.0.1-beta.1->0.0.1-beta.2 git 打上 tag 并提交
  • 发布 beta 版 npm publish --tag=beta
  • npm version patch
  • npm version minor
  • npm version major
  • 详见 https://docs.npmjs.com/cli/v8/commands/npm-version
2.0.0

2 years ago

1.0.1-beta.1

2 years ago