|
|
@ -82,13 +82,15 @@ export default class Now extends EventEmitter { |
|
|
|
forceSync, |
|
|
|
name: pkg.name || basename(path), |
|
|
|
description: pkg.description, |
|
|
|
files: Array.from(this._files).map(([sha, { data, name }]) => { |
|
|
|
return { |
|
|
|
sha, |
|
|
|
size: data.length, |
|
|
|
file: toRelative(name, this._path) |
|
|
|
}; |
|
|
|
}) |
|
|
|
files: [].concat.apply([], Array.from(this._files).map(([sha, { data, names }]) => { |
|
|
|
return names.map((name) => { |
|
|
|
return { |
|
|
|
sha, |
|
|
|
size: data.length, |
|
|
|
file: toRelative(name, this._path) |
|
|
|
}; |
|
|
|
}); |
|
|
|
})) |
|
|
|
} |
|
|
|
}); |
|
|
|
if (this._debug) console.timeEnd('> [debug] /create'); |
|
|
@ -127,9 +129,9 @@ export default class Now extends EventEmitter { |
|
|
|
const uploadChunk = () => { |
|
|
|
Promise.all(parts.shift().map((sha) => retry(async (bail) => { |
|
|
|
const file = this._files.get(sha); |
|
|
|
const { data, name } = file; |
|
|
|
const { data, names } = file; |
|
|
|
|
|
|
|
if (this._debug) console.time(`> [debug] /sync ${name}`); |
|
|
|
if (this._debug) console.time(`> [debug] /sync ${names.join(' ')}`); |
|
|
|
|
|
|
|
const stream = resumer().queue(data).end(); |
|
|
|
const res = await this._fetch('/sync', { |
|
|
@ -139,12 +141,12 @@ export default class Now extends EventEmitter { |
|
|
|
'Content-Length': data.length, |
|
|
|
'x-now-deployment-id': this._id, |
|
|
|
'x-now-sha': sha, |
|
|
|
'x-now-file': toRelative(name, this._path), |
|
|
|
'x-now-file': names.map((name) => toRelative(name, this._path)).join(','), |
|
|
|
'x-now-size': data.length |
|
|
|
}, |
|
|
|
body: stream |
|
|
|
}); |
|
|
|
if (this._debug) console.timeEnd(`> [debug] /sync ${name}`); |
|
|
|
if (this._debug) console.timeEnd(`> [debug] /sync ${names.join(' ')}`); |
|
|
|
|
|
|
|
// no retry on 4xx
|
|
|
|
if (200 !== res.status && (400 <= res.status || 500 > res.status)) { |
|
|
|