Skip to content

Commit 4d2f4b5

Browse files
authored
Merge pull request #139 from FrontEndDev-org/feat/v0.x
Feat/v0.x
2 parents 3ed5947 + e51145e commit 4d2f4b5

File tree

7 files changed

+19
-17
lines changed

7 files changed

+19
-17
lines changed

.github/workflows/code-review.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ name: code review
55
on:
66
push:
77
branches:
8-
- master
98
- v*.x
109
pull_request:
1110
schedule:

.github/workflows/release-please.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
outputs:
1818
release_created: ${{ steps.release.outputs.release_created }}
1919
steps:
20-
- uses: actions/checkout@v3
2120
- uses: google-github-actions/release-please-action@v3
2221
id: release
2322
with:
@@ -46,10 +45,11 @@ jobs:
4645
- uses: ./.github/actions/node-env
4746
- run: npm ci
4847
- run: npm run build
49-
- uses: cloudcome/publish-node-package-action@v1
48+
- uses: FrontEndDev-org/publish-node-package-action@v1
5049
with:
5150
target: npm
5251
token: ${{ secrets.NPM_TOKEN }}
52+
- uses: FrontEndDev-org/npm-mirror-sync-action@v1
5353

5454
publish-github:
5555
runs-on: ubuntu-latest
@@ -61,6 +61,6 @@ jobs:
6161
- uses: ./.github/actions/node-env
6262
- run: npm ci
6363
- run: npm run build
64-
- uses: cloudcome/publish-node-package-action@v1
64+
- uses: FrontEndDev-org/publish-node-package-action@v1
6565
with:
6666
target: github

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
[![code-review](https://github.com/FrontEndDev-org/openapi-axios/actions/workflows/code-review.yml/badge.svg)](https://github.com/FrontEndDev-org/openapi-axios/actions/workflows/code-review.yml)
44
[![dependency-review](https://github.com/FrontEndDev-org/openapi-axios/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/FrontEndDev-org/openapi-axios/actions/workflows/dependency-review.yml)
5-
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/e788387e5e27472ba3b5003bf19aeea7)](https://app.codacy.com/gh/FrontEndDev-org/openapi-axios/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
6-
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/e788387e5e27472ba3b5003bf19aeea7)](https://app.codacy.com/gh/FrontEndDev-org/openapi-axios/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
5+
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4fa1acaeb717469caddfe21a84c50bb2)](https://app.codacy.com/gh/FrontEndDev-org/openapi-axios/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
6+
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/4fa1acaeb717469caddfe21a84c50bb2)](https://app.codacy.com/gh/FrontEndDev-org/openapi-axios/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
77
![npm](https://img.shields.io/npm/v/openapi-axios)
88
![release](https://img.shields.io/github/v/release/FrontEndDev-org/openapi-axios)
99
![license](https://img.shields.io/github/license/FrontEndDev-org/openapi-axios)
1010

1111
OpenAPI ➡️ Axios
1212

13-
将 OpenAPI 规范声明文件转换为类型声明和可执行函数(基于 Axios)。与其他同类工具相比,具有以下特点
13+
将 OpenAPI 规范声明文件转换为类型声明和可执行函数(基于 Axios)。与其他同类工具相比,具有以下特点
1414

1515
- 每个 API 都是一个函数,用于在构建时轻松进行 tree shaking
1616
- 轻松与本地请求客户端集成,例如在本地项目中创建的 Axios 实例
1717
- 易于使用,易于学习,类型安全
1818

19-
# Install
19+
# 安装
2020

2121
```shell
2222
npm i -D openapi-axios
@@ -28,9 +28,9 @@ or
2828
yarn add --dev openapi-axios
2929
```
3030

31-
# Usage
31+
# 使用
3232

33-
## CLI
33+
## 命令行
3434

3535
在项目根目录下创建配置文件,配置文件的搜索顺序是 `openapi.config.cjs``openapi.config.js``openapi.json`
3636

@@ -114,7 +114,7 @@ export async function findPetsByStatus(
114114
```ts
115115
import { findPetsByStatus } from '@/apis/swagger/pet';
116116

117-
// There are type hints when calling functions and writing parameters, thanks to TypeScript.
117+
// 在调用函数和编写参数时,有类型提示,这要感谢 TypeScript
118118
const pets = await findPetsByStatus({
119119
status: ['avaliable'],
120120
});
@@ -130,16 +130,15 @@ generate({
130130
});
131131
```
132132

133-
# Config
133+
# 配置
134134

135135
| 参数名 | 类型 | 可选性 | 描述 | 默认值 |
136136
| -------------------- | --------------- | ------- | --------------------------------------------------------------------------------- | ----------------------------------------------- |
137137
| `cwd` | `string` | `false` | 当前工作路径 | `process.cwd()` |
138138
| `dest` | `string` | `false` | 目标目录 | `src/apis` |
139139
| `axiosImport` | `string` | `false` | axios 导入内容 | 默认从官方 Axios 导入,可以使用自己实现的客户端 |
140140
| `unwrapResponseData` | `boolean` | `false` | 是否取消对 axios response 的包裹(即直接返回 ResponseData,而不是 AxiosResponse) | `false` |
141-
| `list` | `OpenApiSpec[]` | `false` | OpenAPI 规范声明列表 | |
142-
| `[]` | | | | |
141+
| `list` | `OpenApiSpec[]` | `false` | OpenAPI 规范声明列表 | `[]` |
143142

144143
`OpenApiSpec` 签名:
145144

@@ -151,3 +150,7 @@ generate({
151150
| `spec` | `Spec` | `false` | 本地 OpenApi 描述文件 | `undefined` |
152151

153152
备注:`url` 属性和 `spec` 属性,至少有一个必须。
153+
154+
# 鸣谢
155+
156+
- [swagger-typescript-api](https://www.npmjs.com/package/swagger-typescript-api)

src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface StartConfig {
1111
configFile?: string;
1212
}
1313

14-
export const startConfigFiles = ['oas.config.cjs', 'oas.config.js', 'oas.json'];
14+
export const startConfigFiles = ['openapi.config.cjs', 'openapi.config.js', 'openapi.json'];
1515

1616
export async function resolveConfigFile(cwd: string, configFile?: string) {
1717
if (configFile) {

test/commands.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { cleanDir } from '../src/utils';
55

66
test('start', async () => {
77
await start({
8-
configFile: path.join(__dirname, './oas.config.cjs'),
8+
configFile: path.join(__dirname, './openapi.config.cjs'),
99
});
1010
await cleanDir(path.resolve('dist-test'));
1111
});
File renamed without changes.

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
"moduleResolution": "Node",
1717
"baseUrl": "./"
1818
},
19-
"include": ["./src/**/*.ts"]
19+
"include": ["./src/**/*.ts", "./test/**/*.ts"]
2020
}

0 commit comments

Comments
 (0)