fix(angular): accept Angular 20, 21 and 22 as peers - #463
Open
AminDhouib wants to merge 2 commits into
Open
AminDhouib wants to merge 2 commits into
AminDhouib wants to merge 2 commits into
Conversation
@useupup/angular declared @angular/core and @angular/common as ^19.0.0
only, so npm refused to install it on Angular 20+ with ERESOLVE. A spike
on the published 3.3.3 showed that only the range was wrong. Forced in
with --legacy-peer-deps, the package passed a production AOT build, a
build with skipLibCheck:false and strictTemplates, and a headless render
with a file add and a failed upload on 20.3.32, 21.2.24 and 22.2.0, in
both zone and zoneless mode. Its DOM matched the Angular 19 control.
- peerDependencies: @angular/core and @angular/common become
^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0. @angular/platform-browser is
added with the same range, because the FESM imports DomSanitizer from it
without declaring it. rxjs stays ^7.8.0, and the ^19 dev toolchain is
unchanged.
- The description, the README, the Angular quickstart, the framework
guide note and FAQ, and the agent-setup detection rule now say 19–22.
The detection rule said 17+, which never installed.
- peer-dependency-range.spec.ts pins that all three @angular/* peers
accept 19.0.0, 20.0.0, 21.0.0 and 22.0.0. It reads package.json through
a JSON import, so tsconfig.spec.json enables resolveJsonModule. The
workspace has no semver dependency, so the spec carries a small caret
checker. The checker throws on any range syntax it does not model.
RED against the old ^19-only package.json (vitest run
src/peer-dependency-range.spec.ts, exit 1):
❯ src/peer-dependency-range.spec.ts (5 tests | 3 failed) 17ms
✓ accepts versions inside a caret alternative and rejects other majors 3ms
✓ throws on range syntax it does not model instead of passing 1ms
× declares @angular/core as a peer that accepts Angular 19, 20, 21 and 22 7ms
× declares @angular/common as a peer that accepts Angular 19, 20, 21 and 22 2ms
× declares @angular/platform-browser as a peer that accepts Angular 19, 20, 21 and 22 1ms
AssertionError: @angular/core peer range "^19.0.0": expected [ '20.0.0', '21.0.0', '22.0.0' ] to deeply equal []
AssertionError: @angular/common peer range "^19.0.0": expected [ '20.0.0', '21.0.0', '22.0.0' ] to deeply equal []
AssertionError: @angular/platform-browser is missing from peerDependencies: expected undefined to deeply equal Any<String>
Tests 3 failed | 2 passed (5)
GREEN after the change: 5 passed (5); the full angular suite has 276 passed
(20 files).
The quickstarts hub from #460 described @useupup/angular as a component for Angular 19 apps. With the peer range widened, it supports 19 through 22, matching the Angular quickstart, the README and the FAQ.
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
@useupup/angular@3.3.3declares@angular/coreand@angular/commonas^19.0.0only. Angular'slatesttag is 22.2.0, with 20 and 21 on LTS. So anyone following the Angular quickstart on a current Angular app fails at the first command:The same happens on Angular 20.3.32. Both were reproduced on npm 11.19 / Node 24.21.
The package itself was never the problem. The published 3.3.3 was forced in with
--legacy-peer-depson 20.3.32, 21.2.24 and 22.2.0 (TS 6.0.3). On all three it passed:skipLibCheck: falseandstrictTemplates. A deliberate TS2322 proves the.d.tsreally was checked.(filesAdded)and(error). Its DOM matches the Angular 19 control at every state.Both zone and zoneless were covered: 21 and 22 scaffold zoneless by default, and both ends were cross-tested.
What changed
fix(angular): accept Angular 20, 21 and 22 as peers@angular/coreand@angular/commonbecome^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0.@angular/platform-browseris added as a peer with the same range. The FESM already importsDomSanitizerfrom it without declaring it.rxjsstays^7.8.0, and the^19dev toolchain is unchanged.>=19, because 23 is unproven.17+, which never installed.peer-dependency-range.spec.tspins that all three@angular/*peers accept 19.0.0, 20.0.0, 21.0.0 and 22.0.0.semverdependency.package.jsonthrough a JSON import, sotsconfig.spec.jsonenablesresolveJsonModule.docs(landing): quickstarts hub lists Angular 19–22RED against the old
^19-onlypackage.json, fromvitest run src/peer-dependency-range.spec.ts(exit 1):GREEN: 5/5. The full Angular suite passes 276/276.
Checks
All were run on the build host and exited 0:
pnpm install --frozen-lockfile;pnpm-lock.yamlis unchanged.dist/package.jsoncarries all four peers.pnpm run typecheck(31/31) and Angular lint.prettier --checkon every touched file, andprettier-check.vocab:checkandtest:quality(run aftergit add).knip.docs:links:check: 529 links across 72 pages.changeset status.smoke:packages: the packed Angular tarball has the widened peers and@useupup/corepinned to3.3.3, with noworkspace:*left.Fresh Angular apps were scaffolded on a second host, and the smoke tarballs were installed with a plain
npm install:ng build@angular/core@22.2.0@angular/core@20.3.32Notes
packages/, so it routes the MinIO suite. That suite is blocked on the GHCR image pull (fix(ci): pull MinIO images from the org's GHCR mirror #437), so this PR waits behind it..changeset/config.jsonputs all nine packages in one fixed group. The release that ships this bumps all nine to 3.3.4, including@useupup/server, whose trusted-publisher setup still needs a maintainer's npm passkey before it can publish.