1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-18 10:20:39 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
sunnylqm
2021-10-10 12:39:00 +08:00
parent 32d7ed9b00
commit 03a4108a08
8 changed files with 107 additions and 135 deletions

View File

@@ -1,7 +1,3 @@
/**
* Created by tdzl2003 on 2/13/16.
*/
const fetch = require('node-fetch');
const defaultEndpoint = 'http://u.reactnative.cn/api';
let host = process.env.PUSHY_REGISTRY || defaultEndpoint;
@@ -140,11 +136,11 @@ async function uploadFile(fn, key) {
throw new Error(
`此文件大小${(fileSize / 1048576).toFixed(
1,
)}m, 超出当前额度${maxSize}。您可以考虑升级付费业务以提升此额度。详情请访问${pricingPageUrl}`,
)}m, 超出当前额度${maxSize}。您可以考虑升级付费业务以提升此额度。详情请访问: ${pricingPageUrl}`,
);
}
const bar = new ProgressBar(' Uploading [:bar] :percent :etas', {
const bar = new ProgressBar(' 上传中 [:bar] :percent :etas', {
complete: '=',
incomplete: ' ',
total: fileSize,
@@ -177,13 +173,7 @@ async function uploadFile(fn, key) {
Object.assign(new Error(body), { status: resp.statusCode }),
);
}
resolve(
body
? // qiniu
JSON.parse(body)
: // aliyun oss
{ hash: formData.key },
);
resolve({ hash: formData.key });
},
);
});