Skip to content

fix(js): trust exit code for pnpm >= 11 in release-publish executor#35580

Draft
comp615 wants to merge 1 commit intonrwl:masterfrom
comp615:fix/release-publish-pnpm-11
Draft

fix(js): trust exit code for pnpm >= 11 in release-publish executor#35580
comp615 wants to merge 1 commit intonrwl:masterfrom
comp615:fix/release-publish-pnpm-11

Conversation

@comp615
Copy link
Copy Markdown
Contributor

@comp615 comp615 commented May 5, 2026

Current Behavior

nx release publish silently fails when the workspace uses pnpm 11+:

  • pnpm 11 reimplemented pnpm publish natively (feat!: replace npm publish with libnpmpublish pnpm/pnpm#10591). It no longer delegates to the npm CLI.
  • The new implementation accepts --json but writes nothing to stdout on success (the publish handler returns undefined; --json only suppresses the human-readable reporter).
  • release-publish.impl.ts runs the publish command and parses stdout via extractNpmPublishJsonData. With empty stdout the extractor returns { jsonData: null }, the executor logs "The pnpm publish output data could not be extracted" and returns success: false.
  • Combined with the default --nx-bail=true, this aborts the rest of a release after the first parallel batch: tarballs reach the registry for the packages that were attempted, but Nx marks the task failed and skips the remaining packages. Releases look "passed" in CI but are partial.

Tracked at:

Expected Behavior

When pm === 'pnpm' and the detected pnpm major version is >= 11, trust the exit code: execSync already throws on non-zero exit, so reaching this branch means the publish succeeded. Print a minimal summary line and return { success: true }, matching the existing pm === 'bun' branch precedent (added in #34835).

This intentionally drops the verbose === Tarball Details === table for pnpm >= 11. Once pnpm restores --json stdout output (pnpm/pnpm#11476), the JSON extraction path will succeed again and this short-circuit becomes a no-op that can be removed.

The official pnpm-side workaround for users who need the npm-CLI semantics today is pnpm pack && npm publish *.tgz (documented in the changeset for pnpm/pnpm#10591).

Verification of no duplicate PRs

Before opening, I searched open Nx PRs for extract-npm-publish-json-data, release-publish.impl, and #35575 — no open PRs touch this code path.

Related Issue(s)

Refs #35575
Refs pnpm/pnpm#11476
Refs pnpm/pnpm#10591

🤖 Authored with assistance from Amp.

pnpm 11 reimplemented `pnpm publish` natively (pnpm/pnpm#10591), and the
new implementation accepts `--json` but writes nothing to stdout on
success. As a result, `extractNpmPublishJsonData` always returns
`{ jsonData: null }` and the executor incorrectly reports a successful
publish as failed. Combined with `--nx-bail=true`, this silently aborts
the rest of a release: tarballs reach the registry, but Nx marks the
task failed and skips the remaining packages.

Until pnpm restores `--json` stdout output (tracked at
pnpm/pnpm#11476), short-circuit on `pm === 'pnpm' && major >= 11` and
trust the exit code, mirroring the existing `pm === 'bun'` branch.
`execSync` already throws on non-zero exit, so reaching the new branch
means the publish succeeded.

Refs: nrwl#35575
Refs: pnpm/pnpm#11476
Refs: pnpm/pnpm#10591 (official workaround: `pnpm pack && npm publish *.tgz`)
Amp-Thread-ID: https://ampcode.com/threads/T-019df90f-8f75-763f-b528-4602e870a972
Co-authored-by: Amp <amp@ampcode.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 5, 2026

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9cd1b6a

@netlify
Copy link
Copy Markdown

netlify Bot commented May 5, 2026

👷 Deploy request for nx-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9cd1b6a

@comp615
Copy link
Copy Markdown
Contributor Author

comp615 commented May 6, 2026

I think since the pnpm fix got in so quick, we might be able to avoid this and just have some pnpm versions that don't work

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 6, 2026

View your CI Pipeline Execution ↗ for commit 9cd1b6a

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ⛔ Cancelled 4m 2s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 17s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 24s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-06 17:49:47 UTC

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