Skip to content

feat(preview-release): fix latest pollution on first publish + stream pnpm output#20

Merged
rqbazan merged 1 commit into
mainfrom
feat/preview-release-latest-pollution-fix
Jun 27, 2026
Merged

feat(preview-release): fix latest pollution on first publish + stream pnpm output#20
rqbazan merged 1 commit into
mainfrom
feat/preview-release-latest-pollution-fix

Conversation

@rqbazan

@rqbazan rqbazan commented Jun 27, 2026

Copy link
Copy Markdown
Member

Ports the improvements landed in monorepo-preview-release (#18) to the standalone preview-release action, which was merged in #19 without them.

First-time latest pollution

npm force-assigns the latest dist-tag to a package's first-ever publish even when --tag pr-<n> is used, so a brand-new library's preview build silently became the default that pnpm add <pkg> (no tag) resolves to.

The action now captures the first-time publish (checked before publishing) and removes the auto-assigned latest afterwards (pnpm dist-tag rm <pkg> latest), best-effort and never fatal:

  • Only pr-<n> remains, so pnpm add <pkg> fails loudly until a real release re-points latest.
  • <pkg>@pr-<n> and exact-version installs keep working.
  • If the registry refuses the removal, the action logs a warning instead of failing.

Also

  • Streamed output — mutating commands (pnpm version / publish / dist-tag) stream their combined output to the Actions log via a runLogged helper (tinyexec async iterator) inside collapsible groups. The JSON query command (pnpm view) stays silent so its parsed output isn't corrupted.
  • firstTime in payload — reported per package to vland-bot so the PR comment can flag previews whose latest was just removed.
  • core.setSecret(npm_token) — masks any accidental echo in the now-streamed output (this also makes the code match the existing claim in the action's README security notes).

dist/ rebuilt via ncc. tsc and biome check pass.

🤖 Generated with Claude Code

… pnpm output

Port the improvements from monorepo-preview-release (#18) to the standalone
preview-release action.

npm force-assigns the `latest` dist-tag to a package's first-ever publish even
when `--tag pr-<n>` is used, so a brand-new library's preview build silently
became the default that `pnpm add <pkg>` (no tag) resolves to. Capture the
first-time publish (checked before publishing) and remove the auto-assigned
`latest` afterwards (best-effort, never fatal): only `pr-<n>` remains, so
`pnpm add <pkg>` fails loudly until a real release re-points `latest`, while
`<pkg>@pr-<n>` and exact-version installs keep working.

Also:
- Stream mutating commands (pnpm version/publish/dist-tag) to the Actions log
  via a `runLogged` helper using tinyexec's async iterator, while keeping the
  JSON query command (view) silent so its parsed output isn't corrupted.
  tinyexec consumes the child streams once, so we capture during iteration and
  read `proc.exitCode` after the loop.
- Report `firstTime` in the vland-bot payload so the PR comment can flag a
  preview whose `latest` was just removed.
- core.setSecret(npm_token) to mask any accidental echo in streamed output.

dist/ rebuilt via ncc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rqbazan rqbazan merged commit 051a340 into main Jun 27, 2026
1 check passed
@rqbazan rqbazan deleted the feat/preview-release-latest-pollution-fix branch June 27, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant