auto-request
Version:
通过Yapi JSON Schema生成接口Axios或Taro接口
28 lines (24 loc) • 759 B
JavaScript
/**
* 构建模式测试 - open
* 从构建产物导入
*/
const { autoRequest } = require('./../../dist/bundle');
const path = require('path');
const openApi = require('./../../example/open/swagger.json');
const { openConfig, getConfig } = require('./../base/configs');
const generatorApi = (source, api, log, snapshots) => {
const config = getConfig(openConfig, {
snapshotsPath: snapshots,
});
autoRequest(JSON.stringify(source), api, config)
.then(({ write, template }) => {
write();
})
.catch((err) => console.log(err));
};
generatorApi(
openApi,
path.join(__dirname, './../../example/open/api/'),
path.join(__dirname, './../../example/open/logs/'),
path.join(__dirname, './../../example/open/snapshots.md')
);