1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-17 10:02:19 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

Compare commits

..

4 Commits

Author SHA1 Message Date
sunnylqm
a9dea5c188 v1.1.0 2020-03-18 16:06:20 +08:00
sunnylqm
83fe70f840 Revert "seperate key name"
This reverts commit a6477b4f0f.

# Conflicts:
#	src/package.js
2020-03-18 16:06:03 +08:00
sunnylqm
f1dd31cd56 v1.0.9 2020-03-16 19:10:33 +08:00
sunnylqm
a6477b4f0f seperate key name 2020-03-16 19:10:02 +08:00
2 changed files with 6 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "react-native-update-cli",
"version": "1.0.8",
"version": "1.1.0",
"description": "Command tools for javaScript updater with `pushy` service for react native apps.",
"main": "index.js",
"bin": {

View File

@@ -101,7 +101,7 @@ exports.post = queryWithBody('POST');
exports.put = queryWithBody('PUT');
exports.doDelete = queryWithBody('DELETE');
async function uploadFile(fn) {
async function uploadFile(fn, key) {
const { url, backupUrl, formData } = await exports.post('/upload', {});
let realUrl = url;
@@ -112,7 +112,7 @@ async function uploadFile(fn) {
timeout: 1000,
});
// console.log({pingResult});
if (pingResult.avg > 150) {
if (isNaN(pingResult.avg) || pingResult.avg > 150) {
realUrl = backupUrl;
}
// console.log({realUrl});
@@ -127,6 +127,9 @@ async function uploadFile(fn) {
});
const info = await new Promise((resolve, reject) => {
if (key) {
formData.key = key;
}
formData.file = fs.createReadStream(fn);
formData.file.on('data', function(data) {