Repository navigation
fix: publish releases with pnpm to resolve workspace and catalog protocols - #3309
Conversation
…ocols Replaces `lerna publish from-git` with `pnpm -r publish` in the release scripts so pnpm rewrites `workspace:*` and `catalog:` specifiers into concrete versions before uploading the tarballs to npm. Lerna delegates publish to `npm publish`, which has no concept of pnpm's catalog and cannot resolve `workspace:*` outside an npm-declared workspace; this is why @faststore/* 4.0.0 shipped with unresolved protocols (#3307). Also adds a `release:verify` smoke test that packs every public package with `pnpm pack` and fails if any `workspace:` or `catalog:` literal leaks into the tarball's package.json. The check runs in CD before any publish step, guarding against future regressions. Closes #3307
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (3)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
## What's the purpose of this pull request? Bring `dev` into `main` so the next CD run on `main` cuts and publishes `@faststore/*@4.1.0`. Includes the publish-pipeline fix from #3309, so this is also the first release that exercises the `pnpm -r publish` flow end-to-end (broken `4.0.0` is superseded by `4.1.0` as `latest`). ## What's included since v4.0.0 - #3308 — fix: PLP "Load more products" overwriting list instead of appending - #3306 — feat: user details adjusts — SFS-2950 - #3304 — fix: updates schemas vtex.faststore - #3301 — fix: localization selector stale and reset selection for unsaved changes - `d1e40abe7` — fix: add repository field to diagnostics package for OIDC provenance - #3309 — fix: publish releases with pnpm to resolve workspace and catalog protocols (already on `main`, kept by 3-way merge) ## How CD will behave on merge 1. `lerna version --conventional-commits --conventional-graduate --yes` graduates `4.1.0-dev.1` → `4.1.0`, creates tag `v4.1.0`, and pushes the `[no ci] Release: 4.1.0` commit. 2. `pnpm release:verify` packs every public package and asserts no `workspace:` / `catalog:` literal survives the pack step. 3. `pnpm -r publish --access public --no-git-checks` uploads the 8 public packages with all `workspace:*` / `catalog:` references rewritten to concrete versions. ## Sanity checks already performed locally - `git merge-tree` between `origin/main` and `origin/dev`: clean, no conflicts. - `pnpm install --frozen-lockfile` on the merged tree: no lockfile drift. - `pnpm release:verify` on `release/4.1.0`: all 8 public packages clean at `4.1.0-dev.1` (the same manifests that will be bumped to `4.1.0`). ## Follow-ups (not blocking) - Once `4.1.0` is on `latest`, consider `npm deprecate @faststore/<pkg>@4.0.0 "Broken release: workspace:/catalog: not resolved. Use 4.1.0+"` for `cli`, `core`, `api`, `ui`, `components`, `sdk`, `diagnostics`, `lighthouse`. - Optional: add `workflow_dispatch` to `release.yml` so future hotfix releases without `packages/*` changes can be triggered manually with `--force-publish`. Made with [Cursor](https://cursor.com) --------- Co-authored-by: Larícia Mota <[email protected]> Co-authored-by: Matheus P. Silva <[email protected]> Co-authored-by: Leandro Rodrigues <[email protected]> Co-authored-by: vtexgithubbot <[email protected]> Co-authored-by: Lucas Feijó <[email protected]> Co-authored-by: Luiz Falcão <[email protected]> Co-authored-by: Artur Santiago <[email protected]> Co-authored-by: Sahan Jayawardana <[email protected]> Co-authored-by: Mateus Pontes <[email protected]> Co-authored-by: Matheus Martins <[email protected]> Co-authored-by: renatomaurovtex <[email protected]> Co-authored-by: Leandro Rodrigues <[email protected]> Co-authored-by: Fanny Chien <[email protected]> Co-authored-by: Arthur Andrade <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Thiago Pereira <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Giuliana Rigaud <[email protected]> Co-authored-by: renato <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: BrunaCubos <[email protected]> Co-authored-by: Ícaro Oliveira <[email protected]> Co-authored-by: Bruna Santos <[email protected]> Co-authored-by: Everton Ataide <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Otavio Moreira Meirelles <[email protected]> Co-authored-by: Marco Cardoso <[email protected]> Co-authored-by: Gabriel Paladino <[email protected]> Co-authored-by: CodeRabbit <[email protected]>
Summary
lerna publish from-gitwithpnpm -r publishin the release scripts so pnpm rewritesworkspace:*andcatalog:specifiers to concrete versions before uploading the tarballs to npm.lerna versionis kept for bump, tag and changelog generation.pnpm release:verify, a smoke test that packs every publicpackages/*withpnpm packand inspects each tarball'spackage.jsonfor unresolvedworkspace:orcatalog:literals. Wired intorelease.ymlbefore any publish step.Closes #3307.
Why
@faststore/{cli,core,api,ui,components}@4.0.0were published with literalworkspace:*andcatalog:in their dependencies, breaking installs outside the monorepo. Confirmed against the registry:@faststore/[email protected]—@faststore/api: workspace:*,@faststore/core: workspace:*, plus 9+catalog:entries.@faststore/[email protected]— 18catalog:entries (react,react-dom,next,graphql, …).@faststore/[email protected]— 7catalog:entries +@faststore/diagnostics: workspace:*.@faststore/[email protected],@faststore/[email protected]—catalog:for shared deps.Root cause:
lerna publish(regardless ofnpmClient: "pnpm"inlerna.json, which only affects install) delegates the actual upload tonpm publish.npm publishdoes not know about pnpm'scatalog:protocol and only rewritesworkspace:*when the monorepo is declared viaworkspacesin the rootpackage.json(which this repo does not — it usespnpm-workspace.yaml). The regression was introduced in #3302 (v4) when the catalog migration landed without updating the publish pipeline.Changes
package.jsonpnpm -r publishwalkspackages/*, skips private packages, runs the sameprepacklifecycle that the previous flow did (sooclif readmeetc. still execute), and rewritesworkspace:*/catalog:while building each tarball.--no-git-checksis needed becauselerna versionalready created the tag commit.scripts/verify-publish-manifests.mjsStandalone Node script (no extra deps) that:
packages/*/package.json.pnpm packper package into a temp dir.package/package.jsonfrom each.tgzand walksdependencies,devDependencies,peerDependencies,optionalDependencies.workspace:orcatalog:..github/workflows/release.ymlAdded a
Verify publish manifestsstep (runningpnpm release:verify) right before the per-branch publish steps, so a regression to a non-resolving publish tool is caught before anything reaches npm.Test plan
pnpm lint— clean.pnpm release:verifylocally — passes for all 8 public packages on this branch.findUnresolvedProtocols: detectsworkspace:*andcatalog:(named or bare) across all four dep fields.Verify publish manifestsbefore publish on a future release.4.0.1(or4.1.0-dev.x) and confirm vianpm view @faststore/cli@<new> dependenciesthat noworkspace:/catalog:strings appear.