auto-request
Version:
通过Yapi JSON Schema生成接口Axios或Taro接口
29 lines (25 loc) • 785 B
text/typescript
/**
* 开发模式测试 - kae
* 从源码导入
*/
import { autoRequest } from '@/index';
import path from 'path';
import kaeApi from '@/../example/kae/swagger.json';
const { kaeConfig, getConfig } = require('./../base/configs');
const generatorApi = (source, api, log, snapshots) => {
const config = getConfig(kaeConfig, {
loggerPath: log,
snapshotsPath: snapshots,
});
autoRequest(JSON.stringify(source) as any, api, config as any)
.then(({ write, template }: any) => {
write();
})
.catch((err) => console.log(err));
};
generatorApi(
kaeApi,
path.join(__dirname, './../../example/kae/api/'),
path.join(__dirname, './../../example/kae/logs/kae.json'), // 使用完整路径
path.join(__dirname, './../../example/kae/snapshots.md')
);