UNPKG

auto-request

Version:

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

29 lines (25 loc) 802 B
/** * 构建模式测试 - kae * 从构建产物导入 */ const { autoRequest } = require('./../../dist/bundle'); const path = require('path'); const kaeApi = require('./../../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), api, config) .then(({ write, template }) => { 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') );