Skip to content

Commit bfde560

Browse files
committed
feat: 重构
1 parent 34770c4 commit bfde560

21 files changed

+8984
-8046
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
!**/.*
2+
node_modules
3+
lib
4+
dist

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** @type import('haoma').ESLintConfig */
2+
module.exports = require('haoma').getESLintConfig()

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text eol=lf
2+
3+
*.png binary
4+
*.jpg binary
5+
*.gif binary
6+
*.jpeg binary
7+
*.mp3 binary
8+
*.aac binary
9+
*.mp4 binary
10+
*.json linguist-language=JSON-with-Comments

.gitignore

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
*.log
21
node_modules
3-
lib
42
.DS_Store
5-
coverage
6-
ytt.config.ts
7-
/api
3+
Thumbs.db
4+
*.tsbuildinfo
5+
*.log*
86
.tmp*
97
*_cache
10-
/client
8+
/api
9+
/lib
1110
/docs
12-
/src/api
11+
/coverage
12+
ytt.config.*
1313
package-lock.json

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
package-lock.json
3+
yarn.lock
4+
pnpm-lock.yaml
5+
lib
6+
dist

.prettierrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** @type import('haoma').PrettierConfig */
2+
module.exports = require('haoma').getPrettierConfig()

.vscode/settings.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
3-
}
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"eslint.options": {
4+
"resolvePluginsRelativeTo": "."
5+
}
6+
}

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# YApi to TypeScript ![Test](https://github.com/fjc0k/yapi-to-typescript/workflows/Test/badge.svg) [![codecov](https://codecov.io/gh/fjc0k/yapi-to-typescript/branch/master/graph/badge.svg)](https://codecov.io/gh/fjc0k/yapi-to-typescript)
66

7-
根据 [YApi](https://github.com/YMFE/yapi) 的接口定义生成 [TypeScript](https://github.com/Microsoft/TypeScript) 的接口类型及其请求函数代码。
7+
根据 [YApi](https://github.com/YMFE/yapi) 的接口定义生成 TypeScript/JavaScript 的接口类型及其请求函数代码。
88

99
<!-- TOC depthFrom:2 -->
1010

@@ -30,7 +30,6 @@
3030

3131
<img src="https://raw.githubusercontent.com/fjc0k/yapi-to-typescript/master/assets/preview.png?v=20190221" width="700" />
3232

33-
3433
## 特性
3534

3635
- 支持多服务器、多项目、多分类
@@ -40,14 +39,13 @@
4039
- 支持生成 React Hooks 的请求代码
4140
- 支持参数路径
4241
- 支持上传文件
43-
42+
- 支持生成 JavaScript 代码
4443

4544
## 环境要求
4645

4746
- `Node >= 8`
4847
- `YApi >= 1.5.12`
4948

50-
5149
## 安装
5250

5351
```bash
@@ -58,14 +56,13 @@ yarn add yapi-to-typescript
5856
npm i yapi-to-typescript --save
5957
```
6058

61-
6259
## 使用
6360

64-
`yapi-to-typescript` 基于当前目录下的 `ytt.config.ts` 配置文件进行相关操作。
61+
`yapi-to-typescript` 基于当前目录下的 `ytt.config.{ts,js}` 配置文件进行相关操作。
6562

6663
### 生成配置文件
6764

68-
使用命令 `ytt init` 可在当前目录自动创建配置文件 `ytt.config.ts`,如果配置文件已存在,将会询问你是否覆盖:
65+
使用命令 `ytt init` 可在当前目录自动创建配置文件 `ytt.config.{ts,js}`,如果配置文件已存在,将会询问你是否覆盖:
6966

7067
```bash
7168
# yarn
@@ -77,7 +74,7 @@ npx ytt init
7774

7875
### 修改配置文件
7976

80-
打开当前目录下的 `ytt.config.ts` 配置文件,直接修改即可。[查看配置说明](http://fjc0k.github.io/yapi-to-typescript/interfaces/serverconfig.html)
77+
打开当前目录下的 `ytt.config.{ts,js}` 配置文件,直接修改即可。[查看配置说明](http://fjc0k.github.io/yapi-to-typescript/interfaces/serverconfig.html)
8178

8279
### 生成代码
8380

bili.config.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

jest.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/** @type import('haoma').JestConfig */
2+
module.exports = require('haoma').getJestConfig()

0 commit comments

Comments
 (0)