Skip to content

fix(schematics): declare the runtime dependencies the schematics bundle requires - #3747

Merged
armando-navarro merged 2 commits into
angular:mainfrom
armando-navarro:a20-dependency-declarations
Aug 18, 2026
Merged

fix(schematics): declare the runtime dependencies the schematics bundle requires#3747
armando-navarro merged 2 commits into
angular:mainfrom
armando-navarro:a20-dependency-declarations

Conversation

@armando-navarro

Copy link
Copy Markdown
Collaborator

Checklist

  • Issue number for this PR: 3 schematics-required packages undeclared in package.json #3746 (required)
  • Docs included?: No, none affected (dependency manifests only)
  • Test units included?: No. The existing suite passes (156 specs). The fix was verified by building the package and confirming the dist manifest declares all three ranges, and by locating the require calls for all three packages in the built schematics bundles.
  • In a clean directory, yarn install, yarn test run successfully?: yes

Description

Fixes #3746.

The shipped schematics require jsonc-parser, @angular-devkit/core, and @angular-devkit/architect at runtime, but the published manifest never declared them. The first two resolve today only because npm hoists them from the declared @angular-devkit/schematics and @schematics/angular. Architect is not in the package's dependency closure at all and resolves from the app's own @angular/cli install, so ng deploy breaks under pnpm's isolated layout or Yarn Plug'n'Play.

The architect range (>= 0.2100.0 < 0.2200.0) is the comparator pair matching its 0.YYMM version scheme, the same shape other packages shipping architect builders use. A caret on a 0.x version would restrict consumers to Angular 21.0.x only.

The change also prunes allowedNonPeerDependencies in src/ng-package.json to the seven names actually declared, dropping ten entries for dependencies removed long ago and a duplicate @schematics/angular entry.

Refs #3694: that issue proposes moving schematic dependencies out of dependencies entirely. This fix runs the other way in the short term because the shipped bundles genuinely require these packages at runtime, so leaving them undeclared is a correctness bug today. The structural question of where schematic dependencies should live stays open in #3694.

…le requires

The shipped schematics require jsonc-parser, @angular-devkit/core, and
@angular-devkit/architect at runtime, but the published manifest never
declared them. The first two resolve today only because npm hoists them
from the declared @angular-devkit/schematics and @schematics/angular.
Architect is worse: it is not in the package's dependency closure at
all and resolves from the app's own @angular/cli install, so ng deploy
breaks under pnpm's strict layout or Yarn PnP.

The architect range is the comparator pair matching its 0.YYMM version
scheme. A caret on a 0.x version would lock consumers to Angular 21.0.x.

Also prunes the ng-packagr allowlist to the seven names actually
declared, dropping ten entries for dependencies removed long ago and a
duplicate @schematics/angular.
@armando-navarro armando-navarro added bump: patch comp: schematics ng add / deploy schematics (src/schematics). type: bug Defect: expected behavior doesn't happen. labels Aug 17, 2026

@tyler-reitz tyler-reitz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved. I checked this the direct way rather than by reading: built the package on the branch and enumerated every bare require() in dist/packages-dist/schematics/**/*.js against the dist manifest. After this change the set is fully covered, and it matches esbuild's external list at tools/build.ts:349-360 exactly, which is why the bundled-in packages need no declaration. Your hoisting claim holds too: @angular-devkit/schematics and @schematics/angular each depend on @angular-devkit/core and jsonc-parser, and neither pulls architect. 156 specs green here as well.

One thing for later: the architect cap < 0.2200.0 and core's ^21.0.0 both need a manual bump at Angular 22, and nothing tracks src/package.json ranges. The only guard on that file is the comment at src/schematics/common.ts:75 for the firebase range, so this makes a third range that goes stale quietly.

@armando-navarro
armando-navarro enabled auto-merge (squash) August 18, 2026 18:05
@armando-navarro
armando-navarro merged commit 4ff403d into angular:main Aug 18, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bump: patch comp: schematics ng add / deploy schematics (src/schematics). type: bug Defect: expected behavior doesn't happen.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 schematics-required packages undeclared in package.json

2 participants