Skip to content

feat: support workspace-managed native publishing - #88

Merged
nflaig merged 2 commits into
mainfrom
fix/platform-only-publishing
Oct 31, 2026
Merged

nflaig merged 2 commits into
mainfrom
fix/platform-only-publishing

Conversation

@wemeetagain

@wemeetagain wemeetagain commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

A workspace publisher such as Lerna must own the wrapper's version and publication, while zapi handles the native platform packages. Currently both tools can publish the wrapper, and preparing its optional dependencies before Lerna starts dirties the tracked manifest.

This separates the existing commands by package type:

  • prepublish --platforms-only prepares platform packages without modifying the wrapper manifest.
  • prepublish --main-only updates native optional dependencies while preserving unrelated dependencies and removing retired native targets. Running it in prepack generates the wrapper metadata after Lerna's clean-tree check.
  • publish --platforms-only publishes platforms and leaves the wrapper to the workspace publisher.
  • publish --skip-existing skips existing versions in the destination registry. It respects publishConfig, scoped registries, and explicit npm CLI overrides; failures other than E404 abort. Existing versions and dist-tags remain untouched.

Preparation copies artifacts so it can be repeated and fails if an artifact is missing. Generated platform packages inherit publishConfig. Publishing checks every platform's name, version, and binary before registry requests, supports absolute output paths, and rejects unsupported zapi flags instead of silently ignoring them. npm options go after --.

Without package-selection flags, zapi still prepares both package types and publishes platforms before the wrapper. The README documents the lifecycle, retry behavior, and Lerna integration.

This PR was written primarily by OpenAI Codex.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T10:13:46.473105Z 8b823d0 PR opened
🔒 Security Review ✅ Completed 2026-10-30T10:15:46.471713Z 8b823d0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8b823d0d2d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ts/publish.ts Resolved
@matthewkeil matthewkeil moved this from In Progress to Awaiting Author in Lodestar Team Coordination Oct 30, 2026

@nflaig nflaig left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Checked the Lerna flow against lerna-lite: the manifest is reloaded after prepack and read from disk at publish, so optionalDependencies reach the registry metadata.

Non-blocking: a quick re-run during registry lag can still hit E403 "cannot publish over the previously published versions"; treating that as skipped (like lerna-lite does) would cover it.

@nflaig
nflaig merged commit 78ba34f into main Oct 31, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Awaiting Author to Done in Lodestar Team Coordination Oct 31, 2026
nflaig pushed a commit that referenced this pull request Oct 31, 2026
🤖 I have created a release *beep* *boop*
---


##
[4.3.0](zapi-v4.2.0...zapi-v4.3.0)
(2026-10-31)


### Features

* support workspace-managed native publishing
([#88](#88))
([78ba34f](78ba34f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
nflaig added a commit to ChainSafe/lodestar that referenced this pull request Oct 31, 2026
publish-dev has failed on every unstable push since
#10513. zapi published
`@lodestar/native` seconds before `lerna publish from-package` checked
the registry. npm still reported the version as unpublished, so Lerna
ran the wrapper's `prepublishOnly` guard and the job failed. Only the 7
native packages reached npm, and the Docker publish was skipped.

This bumps zapi to 4.3.0 (ChainSafe/zapi#88) and
splits publishing by package type:

- zapi builds and publishes only the platform packages, with
`--skip-existing` so a failed release can be re-run from any point.
- Lerna publishes the wrapper with the other packages. Its `prepack`
script (`zapi prepublish --main-only`) pins the platform packages as
`optionalDependencies`, replacing the throwing guard.

Verified locally with fake artifacts:

- `zapi publish --platforms-only --skip-existing --dry-run` would
publish all 6 platforms for an unpublished version and skips all 6 for
`1.51.0-dev.122e5d5f21`.
- `lerna publish from-package --dry-run` found only
`@lodestar/native@1.50.1` unpublished, ran `prepack`, and the packed
tarball lists all 6 platform `optionalDependencies`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants