@within-7/jetr 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +10 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -279,12 +279,19 @@ async function deploy(siteName, directory, onProgress) {
|
|
|
279
279
|
`Upload: ${diff.upload.length}, Delete: ${diff.delete.length}, Unchanged: ${diff.unchanged.length}`
|
|
280
280
|
);
|
|
281
281
|
if (diff.upload.length > 0) {
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
const CONCURRENCY = 10;
|
|
283
|
+
let completed = 0;
|
|
284
|
+
const total = diff.upload.length;
|
|
285
|
+
const uploadOne = async (fp) => {
|
|
284
286
|
const absPath = join3(absDir, fp);
|
|
285
287
|
const content = readFileSync3(absPath);
|
|
286
|
-
onProgress?.(`Uploading (${i + 1}/${diff.upload.length}) ${fp}`);
|
|
287
288
|
await api.uploadFile(siteName, fp, content, diff.deploy_id, manifest[fp].hash);
|
|
289
|
+
completed++;
|
|
290
|
+
onProgress?.(`Uploading (${completed}/${total}) ${fp}`);
|
|
291
|
+
};
|
|
292
|
+
for (let i = 0; i < total; i += CONCURRENCY) {
|
|
293
|
+
const batch = diff.upload.slice(i, i + CONCURRENCY);
|
|
294
|
+
await Promise.all(batch.map(uploadOne));
|
|
288
295
|
}
|
|
289
296
|
}
|
|
290
297
|
onProgress?.("Finalizing...");
|