Browse Source

feat(release): count publish progress against the whole release set

A dsh publication uploads 221 packages one at a time, spaced apart, and
the log gave no way to tell how far along a run was: every line named a
package, none said where that package sat in the set.

Each per-package line now carries [n/total]. Every entry in the order
settles as either published or already present, so the counter is both
"packages settled" and "position in the publish order", and the closing
summary names the member count alongside the published and skipped
totals.
imccyu 1 month ago
parent
commit
d5be1d62c9
1 changed files with 13 additions and 4 deletions
  1. 13 4
      scripts/release/publish.ts

+ 13 - 4
scripts/release/publish.ts

@@ -136,9 +136,15 @@ async function main(): Promise<void> {
   const family = releaseFamily(values.family)
   const family = releaseFamily(values.family)
   const directory = resolve(process.cwd(), values.from)
   const directory = resolve(process.cwd(), values.from)
 
 
+  // Every entry in the order settles as either published or already present, so
+  // one counter answers "how far along is this run" for whoever is watching a
+  // release that takes minutes per family.
+  const order = readPublishOrder(directory)
+  const total = String(order.length)
   let published = 0
   let published = 0
   let skipped = 0
   let skipped = 0
-  for (const filename of readPublishOrder(directory)) {
+  for (const [index, filename] of order.entries()) {
+    const progress = `[${String(index + 1)}/${total}]`
     const tarball = join(directory, filename)
     const tarball = join(directory, filename)
     const { name, version } = packedIdentity(tarball)
     const { name, version } = packedIdentity(tarball)
     const state = registryState(name, version)
     const state = registryState(name, version)
@@ -151,7 +157,7 @@ async function main(): Promise<void> {
           + '\nBump the version, or investigate why the build is not reproducible.',
           + '\nBump the version, or investigate why the build is not reproducible.',
         )
         )
       }
       }
-      console.log(`release publish: ${name}@${version} already published, skipping`)
+      console.log(`release publish: ${progress} ${name}@${version} already published, skipping`)
       skipped += 1
       skipped += 1
       continue
       continue
     }
     }
@@ -159,11 +165,14 @@ async function main(): Promise<void> {
     // only skips does not wait at all.
     // only skips does not wait at all.
     if (published > 0) await sleep(PUBLISH_SPACING_MS)
     if (published > 0) await sleep(PUBLISH_SPACING_MS)
     await publishTarball(tarball, name, version)
     await publishTarball(tarball, name, version)
-    console.log(`release publish: ${name}@${version} published`)
+    console.log(`release publish: ${progress} ${name}@${version} published`)
     published += 1
     published += 1
   }
   }
 
 
-  console.log(`release publish: family ${family.id}, ${String(published)} published, ${String(skipped)} already present`)
+  console.log(
+    `release publish: family ${family.id}, ${total} member(s),`
+    + ` ${String(published)} published, ${String(skipped)} already present`,
+  )
 }
 }
 
 
 if (isEntry(import.meta.url)) await main()
 if (isEntry(import.meta.url)) await main()