Backoffice: Preserve prerelease tag when hoisting peer dependencies#22841
Conversation
The publish cleanse step strips the prerelease suffix from hoisted dependency ranges via `semver.minVersion(...).major/minor/patch`. For `^2.0.0-rc.1` this produced `^2.0.0`, which no published `@umbraco-ui/uui` version currently satisfies, breaking extension installs against `@umbraco-cms/backoffice@18.0.0-beta1`+. Use the full SemVer (including any prerelease) as the floor so `^2.0.0-rc.1` stays satisfiable by the actual published rc.
|
Claude finished @iOvergaard's task in 1m 41s —— View job PR ReviewTarget: Fixes a publish-time regression where
Suggestions
ApprovedThe fix is correct and minimal. |
There was a problem hiding this comment.
[Suggestion] No automated tests exist for looseVersionRange(), and none are added in this PR. The devops directory has no test infrastructure today, so this isn't a blocker — but this function now has meaningful branching logic (stable vs. prerelease, 0.x.y vs. major≥1) that would benefit from a small unit test suite (e.g., a Node.js --test or Vitest file in devops/publish/). The PR description's manual verification table would be a good starting point for test cases.
There was a problem hiding this comment.
Pull request overview
Fixes the publish-time package cleansing step for @umbraco-cms/backoffice so that prerelease version ranges aren’t rewritten into unsatisfiable stable ranges, preventing npm install failures for extension developers consuming 18.x beta/rc packages.
Changes:
- Updates
looseVersionRange()to preserve prerelease suffixes when reconstructing the “floor” version fromsemver.minVersion(...). - Ensures both
^...ranges and0.x.yranges keep prerelease tags (e.g.^2.0.0-rc.1remains^2.0.0-rc.1).
AndyButland
left a comment
There was a problem hiding this comment.
Looks good. Checking the entry in npm/umbraco-cms-backoffice-18.1.0-rc.g4df33a6.tgz/package.json from this build I see:
"@umbraco-ui/uui": "^2.0.0-rc.1",
But from umbraco-cms-backoffice-18.0.0-beta1.tgz/package.json for release-18.0.0-beta1 we have:
"@umbraco-ui/uui": "^2.0.0",
…22841) The publish cleanse step strips the prerelease suffix from hoisted dependency ranges via `semver.minVersion(...).major/minor/patch`. For `^2.0.0-rc.1` this produced `^2.0.0`, which no published `@umbraco-ui/uui` version currently satisfies, breaking extension installs against `@umbraco-cms/backoffice@18.0.0-beta1`+. Use the full SemVer (including any prerelease) as the floor so `^2.0.0-rc.1` stays satisfiable by the actual published rc.
Summary
The publish-time cleanse step that rewrites workspace
dependenciesinto the publishedpeerDependenciesof@umbraco-cms/backofficewas stripping the prerelease suffix from version ranges.^2.0.0-rc.1(the version@umbraco-backoffice/uuideclares for@umbraco-ui/uui) was being collapsed to^2.0.0, which no published@umbraco-ui/uuiversion satisfies — only2.0.0-rc.0/-rc.1are on npm so far. The result was that@umbraco-cms/backoffice@18.0.0-beta1+ (which is what extension developers are installing) listed an unresolvable peer dep andnpm installfailed:Cause:
looseVersionRange()indevops/publish/cleanse-pkg.jsreadsemver.minVersion(...).major/minor/patchand discarded the.prereleasearray when rebuilding the range string.Fix: include the prerelease suffix when present, so
^2.0.0-rc.1round-trips as^2.0.0-rc.1and accepts2.0.0-rc.1, future RCs/betas, and the eventual stable 2.x.Verified with semver semantics:
The only workspace currently affected is
src/external/uui(@umbraco-ui/uui@^2.0.0-rc.1). All other external workspace deps already use stable ranges and produce the same output as before.Test plan
release/18.0so the fix lands in the next 18.0.0-beta/rc packagenpm run build:for:cmsandnpm packinsrc/Umbraco.Web.UI.Client, inspect thepeerDependenciesof the resulting tarball —@umbraco-ui/uuishould be^2.0.0-rc.1, not^2.0.0npm install @umbraco-cms/backoffice@<new-build>in an extension project resolves cleanly🤖 Generated with Claude Code