UNPKG

auto-request

Version:

通过Yapi JSON Schema生成接口Axios或Taro接口

28 lines (24 loc) 813 B
/** * 构建模式测试 - usercenter * 从构建产物导入 */ const { autoRequest } = require('./../../dist/bundle'); const path = require('path'); const usercenterApi = require('./../../example/usercenter/swagger.json'); const { usercenterConfig, getConfig } = require('./../base/configs'); const generatorApi = (source, api, log, snapshots) => { const config = getConfig(usercenterConfig, { snapshotsPath: snapshots, }); autoRequest(JSON.stringify(source), api, config) .then(({ write, template }) => { write(); }) .catch((err) => console.log(err)); }; generatorApi( usercenterApi, path.join(__dirname, './../../example/usercenter/api/'), path.join(__dirname, './../../example/usercenter/logs/'), path.join(__dirname, './../../example/usercenter/snapshots.md') );