// import request from '../utils/request'; // import { compareVersion } from '../utils/util'; // import local from '../utils/local'; // import logger from '../utils/logger'; // Generated by https://quicktype.io export interface ToolVersion { docUrl: string; downloadUrl: string; platform: string; pluginName: string; versionName: string; } // 一天的缓存 // const CACHE_KEY = 'update_version'; // const ONE_DAY = 24 * 60 * 60 * 1000; // 当前版本 // VERSION export default async function getLatestVersion() { // const data = local.getItem(CACHE_KEY) || 0 // const now = Date.now() // // 不存在缓存,或者已过期 // if (data + ONE_DAY > now) { // return // } // const { versionName } = await request({ // method: 'GET', // host: 'ide', // path: '/ide/api/toolVersion.json', // data: { // clientType: 'CLI', // platform: 'all', // }, // }).catch(() => { // return { // versionName: '0.0.0', // } // }) // if (compareVersion(VERSION, '<', versionName)) { // logger.dashedLog([ // `Update available ${VERSION} -> ${versionName}`, // 'Run npm i alipay-dev -g to update', // ]) // } // local.setItem(CACHE_KEY, now) }