fix(release): keep npm's own output in the publish log

Retry classification needs npm's failure text, so the publish call captured its
streams instead of inheriting them. That silenced npm on the success path: the
log lost the tarball contents, the notices, and the '+ name@version'
confirmation for every package.

Pipe the streams and echo them, so the log shows what npm reported and the
caller still gets the text it classifies. The registry probe behind it keeps its
streams captured, since its JSON and its E404 are internal queries rather than
progress.
This commit is contained in:
imccyu
2026-08-14 11:27:14 +08:00
parent 47399764c5
commit 70eb76eaec
2 changed files with 28 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ import { join, resolve } from 'node:path'
import { setTimeout as sleep } from 'node:timers/promises'
import { parseArgs } from 'node:util'
import { releaseFamily } from './families.ts'
import { attempt, isEntry } from './process.ts'
import { attempt, attemptStreaming, isEntry } from './process.ts'
import { packedIdentity, readPublishOrder } from './tarball.ts'
/**
@@ -102,7 +102,7 @@ async function publishTarball(tarball: string, name: string, version: string): P
// command-line flag could not serve both and would override the manifest
// that does. Each packed manifest decides, and
// check-workspace-constraints holds every manifest to its sequence's level.
const result = attempt('npm', ['publish', tarball, ...tagArgs])
const result = attemptStreaming('npm', ['publish', tarball, ...tagArgs])
const output = `${result.stdout}${result.stderr}`
if (result.status === 0) return