@somewhere-cloud/cli 0.38.175 → 0.38.176

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.38.176
4
+
5
+ - Upload large static sites faster and show hashing and upload times with `deploy --timing`.
6
+
3
7
  ## 0.38.175
4
8
 
5
9
  - Enabled apps can deploy larger static sites and upload only files that changed.
@@ -78913,12 +78913,15 @@ async function uploadDeployBlobs(client, dir, projectId, paths, hashes) {
78913
78913
  }
78914
78914
  process.stderr.write(`Checking ${paths.size} static files...
78915
78915
  `);
78916
+ const checkStarted = performance.now();
78916
78917
  const { missing } = await client.call("POST", "/deploy/blobs/check", {
78917
78918
  project_id: projectId,
78918
78919
  files: [...files.values()].map(({ sha256: sha2563, size }) => ({ sha256: sha2563, size }))
78919
78920
  }, void 0, { timeoutMs: LONG_CALL_TIMEOUT_MS });
78921
+ const checkMs = performance.now() - checkStarted;
78920
78922
  process.stderr.write(`Uploading ${missing.length} of ${files.size} distinct static files.
78921
78923
  `);
78924
+ const uploadStarted = performance.now();
78922
78925
  let next = 0;
78923
78926
  let failure2;
78924
78927
  const query = new URLSearchParams({ project_id: projectId });
@@ -78944,14 +78947,16 @@ async function uploadDeployBlobs(client, dir, projectId, paths, hashes) {
78944
78947
  }));
78945
78948
  if (failure2)
78946
78949
  throw failure2;
78947
- return Object.fromEntries([...paths.keys()].map((path3) => [path3, `sha256:${hashes[path3]}`]));
78950
+ const uploadMs = performance.now() - uploadStarted;
78951
+ const blobFiles = Object.fromEntries([...paths.keys()].map((path3) => [path3, `sha256:${hashes[path3]}`]));
78952
+ return { blobFiles, checkMs, uploadMs };
78948
78953
  }
78949
78954
  var PARALLEL_UPLOADS;
78950
78955
  var init_deploy_blobs = __esm({
78951
78956
  "dist/lib/deploy-blobs.js"() {
78952
78957
  "use strict";
78953
78958
  init_client();
78954
- PARALLEL_UPLOADS = 8;
78959
+ PARALLEL_UPLOADS = 32;
78955
78960
  __name(uploadDeployBlobs, "uploadDeployBlobs");
78956
78961
  }
78957
78962
  });
@@ -84730,6 +84735,7 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
84730
84735
  include: opts.include ?? [],
84731
84736
  deployBlobs: process.env.SOMEWHERE_DEPLOY_BLOBS === "1" && !opts.dryRun && opts.scope !== "functions"
84732
84737
  });
84738
+ const hashStartedAt = collected.blobs?.size && opts.timing ? performance.now() : void 0;
84733
84739
  const publishedHashes = hashFiles(targetDir, collected.published);
84734
84740
  const collectionEndedAt = performance.now();
84735
84741
  const collectionMs = collectionEndedAt - collectionStartedAt;
@@ -85225,7 +85231,12 @@ Existing app: \`${cliInvocation()} pull <app>\` downloads the live source and li
85225
85231
  }
85226
85232
  if (collected.blobs?.size) {
85227
85233
  spinner?.stop();
85228
- body.blob_files = await uploadDeployBlobs(client, targetDir, projectId, collected.blobs, publishedHashes);
85234
+ const { blobFiles, checkMs, uploadMs } = await uploadDeployBlobs(client, targetDir, projectId, collected.blobs, publishedHashes);
85235
+ body.blob_files = blobFiles;
85236
+ if (hashStartedAt !== void 0) {
85237
+ process.stderr.write(`Static file timings (ms) \u2014 hash ${Math.round(collectionEndedAt - hashStartedAt)}, check ${Math.round(checkMs)}, upload ${Math.round(uploadMs)}
85238
+ `);
85239
+ }
85229
85240
  if (process.stderr.isTTY)
85230
85241
  spinner?.start();
85231
85242
  }