fix(build): name canaries after the release, not after a prerelease - #3767
armando-navarro wants to merge 2 commits into
Conversation
The root version field held `21.0.0-rc.1`, so every merge to main published `21.0.0-rc.1-canary.<sha>`. Semver ranks that above `21.0.0-rc.1`, and the caret range `ng add` writes into a user's package.json then resolves to the canary instead of the release candidate they asked for. Releases through v20 avoided this by keeping the plain release number in the version field and publishing prereleases from their own git tag, which is what the publish job reads. This restores that: the field returns to `21.0.0`, and build.sh drops any prerelease part when naming a canary, so a prerelease written there again cannot produce a canary that outranks it. The schematics comment and its log line no longer say a prerelease range matches canary builds, which stops being true here.
The sample's lockfile still named `angular-fire-21.0.0-rc.0.tgz`, two releases behind its own package.json, so `npm ci` there failed on the mismatch. Regenerated by building the library and running `npm install ../angular-fire-21.0.0.tgz` in sample/. It also picks up the `^21.2.0` peer ranges the Angular 21.2 raise introduced.
tyler-reitz
left a comment
There was a problem hiding this comment.
Approving. Every naming path reproduces: I ran this branch's build.sh with npm version/npm run build stubbed, and a merge to main gives 21.0.0-canary.95b3de1 on canary, tag 21.0.0-rc.2 gives next, tag 21.0.0 gives latest, and a prerelease left in the version field still yields 21.0.0-canary.95b3de1 with the new log line.
One thing for the release notes rather than for this PR. The 25 canaries already on npm outrank every future rc of 21.0.0, not just rc.1. Their prerelease parses as ["rc", "1-canary", "95b3de1"], and the alphanumeric 1-canary ranks above the numeric 2, so ^21.0.0-rc.2 and ~21.0.0-rc.2 both still resolve to 21.0.0-rc.1-canary.95b3de1. #3766's scope note is accurate, but it reads as though rc.2 clears this. It will not; deprecating the 25 would.
Fixes #3766
These changes take us back to the release candidate pattern this repo used up until #3674, after which
@angular/fire@nextstarted resolving to a canary build instead of the release candidate.Details
package.jsonversion field returns to21.0.0, so a canary published from main is named21.0.0-canary.<sha>, which ranks below every21.0.0-rc.N.tools/build.shtakes a tagged release's version from.tools/build.shalso drops any prerelease part when naming a canary, and says so in the build log, so a prerelease written into that field again cannot produce a canary that outranks it.src/schematics/common.tsno longer say a prerelease range matches canary builds, since it stops being true with this PR.angular-fire-21.0.0.tgz.sample/package-lock.json, which still named the21.0.0-rc.0tarball, two releases behind its ownpackage.json.Verification
Every naming path was run against the real script.
21.0.0, a merge to main and a pull request build:21.0.0-canary.95b3de1on thecanarytag21.0.0-rc.2publishes21.0.0-rc.2onnext21.0.0publishes21.0.0onlatest.21.0.0-canary.95b3de1, logging why.21.0.0-canary.95b3de1is selected by none of^21.0.0-rc.1,~21.0.0-rc.1,^21.0.0-rc.2,^21.0.0or21.x, and ranks below21.0.0-rc.1.npm run test:nodeafter a full build: 331 specs, 0 failures.angular-fire-21.0.0.tgz, andnpm ciinsample/succeeds against the regenerated lockfile, where it previously failed on the mismatch.