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.
This commit is contained in:
imccyu
2026-08-14 16:10:06 +08:00
parent 0e50fa290c
commit d5be1d62c9
+13 -4
View File
@@ -136,9 +136,15 @@ async function main(): Promise<void> {
const family = releaseFamily(values.family)
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 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 { name, version } = packedIdentity(tarball)
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.',
)
}
console.log(`release publish: ${name}@${version} already published, skipping`)
console.log(`release publish: ${progress} ${name}@${version} already published, skipping`)
skipped += 1
continue
}
@@ -159,11 +165,14 @@ async function main(): Promise<void> {
// only skips does not wait at all.
if (published > 0) await sleep(PUBLISH_SPACING_MS)
await publishTarball(tarball, name, version)
console.log(`release publish: ${name}@${version} published`)
console.log(`release publish: ${progress} ${name}@${version} published`)
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()