-
Notifications
You must be signed in to change notification settings - Fork 1
/
ytt.config.ts
69 lines (64 loc) · 1.65 KB
/
ytt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// import { Config } from 'yapi-to-typescript';
// const config: Config = [
// {
// serverUrl: 'http://39.99.162.233:3000',
// typesOnly: false,
// reactHooks: {
// enabled: true,
// },
// devEnvName: 'dev',
// prodEnvName: 'production',
// outputFilePath: 'src/api/index.ts',
// requestFunctionFilePath: 'src/api/request.ts',
// // dataKey: '',
// projects: [
// {
// token: '045a8d1d98f859a5d111',
// categories: [
// {
// id: 26,
// getRequestFunctionName(interfaceInfo, changeCase) {
// return changeCase.camelCase(interfaceInfo.parsedPath.name);
// },
// },
// ],
// },
// ],
// },
// ];
import { Config, ExtendedInterface, ChangeCase } from 'yapi-to-typescript';
const token = '5911189697ac33dfd098dc15b6f987e3d9a62cdb09f9e115a799b0f248ded6cf';
const getRequestFunctionName = (
interfaceInfo: ExtendedInterface,
changeCase: ChangeCase
) => {
const {method, parsedPath} = interfaceInfo
const { name, dir } = parsedPath;
const dirString = dir.replace(/\//g, ' ');
return changeCase.camelCase(`api_${method}_${name}`);
};
const config: Config = [
{
serverUrl: 'http://121.89.170.197:3000',
typesOnly: false,
reactHooks: {
enabled: true,
},
devEnvName: 'dev',
// prodEnvName: 'prod',
outputFilePath: 'src/api/index.ts',
requestFunctionFilePath: 'src/api/request.ts',
projects: [
{
token,
categories: [
{
id: [18],
getRequestFunctionName,
},
],
},
],
},
];
export default config;