Skip to content

fix(angular): multi-version support compliance#35587

Draft
leosvelperez wants to merge 2 commits intomasterfrom
nxc-4381
Draft

fix(angular): multi-version support compliance#35587
leosvelperez wants to merge 2 commits intomasterfrom
nxc-4381

Conversation

@leosvelperez
Copy link
Copy Markdown
Member

@leosvelperez leosvelperez commented May 6, 2026

Current Behavior

  • @nx/angular silently falls through to the v21 install constants when a workspace has @angular/core detected below the supported floor (v19). Generators add v21 packages incompatible with the user's setup instead of failing fast.
  • Three cross-major Module Federation packageJsonUpdates entries (20.2.0-module-federation, 22.2.0, 22.6.0-module-federation) lack requires gates, so each bump fires for every workspace regardless of the installed @module-federation/* source major.
  • The update-unit-test-runner-option migration declares @angular/core: >=21.0.0 despite only rewriting an Nx generator default in nx.json (unitTestRunner: 'vitest''vitest-analog'). Pre-v21 workspaces that already have the stale default never run the migration and stay broken (the value is no longer in the generator schema's enum).
  • The add-linting generator overwrites already-installed third-party versions because it doesn't pass keepExistingVersions=true to addDependenciesToPackageJson.

Expected Behavior

  • A workspace with @angular/core detected below v19 throws with a clear, standardized message naming the package, the installed version, and the supported floor (no silent fall-through). The fresh-install path (no @angular/core detected) still resolves to the latest supported version.
  • Each MF packageJsonUpdates entry gates on the @module-federation/enhanced source range it is bumping from, so the bump only fires for workspaces actually in that range.
  • The update-unit-test-runner-option migration runs for any workspace with the stale generator default, regardless of installed Angular version.
  • The add-linting generator preserves already-installed dependency pins.

A new internal helper throwForUnsupportedVersion is added to @nx/devkit/internal so first-party plugins can produce a consistent below-floor error format. It is intentionally not part of the public @nx/devkit surface — only first-party plugins will consume it as the rest of the multi-version compliance rollout lands.

…rnal

Standardized helper for first-party plugins to throw a consistent error
when a third-party package is detected below the plugin's supported
floor. Naming the package, installed version, and floor in one place
keeps out-of-window UX uniform across plugins and grep-enforceable.

Exposed via `@nx/devkit/internal` only — not part of the public devkit
API.

Implements NXC-4378.
- Throw via the new `@nx/devkit/internal` `throwForUnsupportedVersion`
  util when a workspace has @angular/core detected below the supported
  floor (v19), replacing the silent fall-through to the latest install
  constants. The fresh-install path (no detected @angular/core) is
  unchanged.
- Gate the three cross-major Module Federation `packageJsonUpdates`
  entries (`20.2.0-module-federation`, `22.2.0`,
  `22.6.0-module-federation`) on `@module-federation/enhanced` source
  ranges so the bumps no longer fire for workspaces below each entry's
  source major.
- Drop the spurious `@angular/core: >=21.0.0` `requires` from the
  `update-unit-test-runner-option` migration. The migration only
  rewrites an Nx generator default in nx.json (`unitTestRunner:
  'vitest'` → `'vitest-analog'`); the previous gate skipped pre-v21
  workspaces that still have the now-invalid default and is unrelated
  to Angular's installed version.
- Pass `keepExistingVersions=true` to `addDependenciesToPackageJson` in
  the add-linting generator so workspaces with the targeted packages
  already pinned are not silently bumped.

Implements NXC-4381.
@leosvelperez leosvelperez self-assigned this May 6, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit f7af3dc
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69fb36be27b1560008f8795f
😎 Deploy Preview https://deploy-preview-35587--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit f7af3dc
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69fb36be6770d40008a61ac4
😎 Deploy Preview https://deploy-preview-35587--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 6, 2026

View your CI Pipeline Execution ↗ for commit f7af3dc

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ⛔ Cancelled 3m 44s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 16s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 24s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-06 14:51:46 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant