UNPKG

@hz-lib/hz-build-cli

Version:

hz-build-cli 脚手架

40 lines (33 loc) 796 B
/* * @Author: your name * @Date: 2021-10-21 10:04:49 * @LastEditTime: 2021-10-22 11:04:15 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \cli\hz-cli\lib\http.js */ // lib/http.js // 通过 axios 处理请求 const axios = require('axios') axios.interceptors.response.use(res => { return res.data; }) /** * 获取模板列表 * @returns Promise */ async function getRepoList() { return axios.get('https://api.github.com/users/hz-bulid/repos') } /** * 获取版本信息 * @param {string} repo 模板名称 * @returns Promise */ async function getTagList(repo) { return axios.get(`https://api.github.com/repos/hz-bulid/${repo}/releases`) } module.exports = { getRepoList, getTagList }