Skip to content

fix(core): ensure nx init implementation for angular correctly resolves @angular/core#31430

Merged
leosvelperez merged 1 commit intomasterfrom
angular/fix-ng-nx-init-legacy
Jun 3, 2025
Merged

fix(core): ensure nx init implementation for angular correctly resolves @angular/core#31430
leosvelperez merged 1 commit intomasterfrom
angular/fix-ng-nx-init-legacy

Conversation

@leosvelperez
Copy link
Copy Markdown
Member

@leosvelperez leosvelperez commented Jun 3, 2025

Current Behavior

When running nx init in an Angular CLI repo located in a directory that has an ancestor directory with an Nx installation, it silently exits when trying to determine the compatibility of the Angular version. The migration is not performed, and no feedback is given to the user. This happens because the current implementation will determine that ancestor directory (outside the workspace root) as the workspace root (when starting the migration, there's no nx in the repo).

Expected Behavior

Running nx init should work correctly, and proper feedback should be printed to the user if it can't determine the compatibility of the Angular version. It should correctly resolve the @angular/core package from the Angular CLI workspace root.

Related Issue(s)

Fixes #31291

@leosvelperez leosvelperez self-assigned this Jun 3, 2025
@leosvelperez leosvelperez requested review from a team as code owners June 3, 2025 08:30
@leosvelperez leosvelperez requested review from Cammisuli and jaysoo June 3, 2025 08:30
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Jun 3, 2025 8:46am

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Jun 3, 2025

View your CI Pipeline Execution ↗ for commit b985c5a.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 30m 23s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 18s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 5s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 4s View ↗
nx documentation ✅ Succeeded 1m 3s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-03 09:07:31 UTC

@leosvelperez leosvelperez merged commit cb930d0 into master Jun 3, 2025
8 checks passed
@leosvelperez leosvelperez deleted the angular/fix-ng-nx-init-legacy branch June 3, 2025 10:55
FrozenPandaz pushed a commit that referenced this pull request Jun 3, 2025
…es `@angular/core` (#31430)

## Current Behavior

When running `nx init` in an Angular CLI repo located in a directory
that has an ancestor directory with an Nx installation, it silently
exits when trying to determine the compatibility of the Angular version.
The migration is not performed, and no feedback is given to the user.
This happens because the current implementation will determine that
ancestor directory (outside the workspace root) as the workspace root
(when starting the migration, there's no `nx` in the repo).

## Expected Behavior

Running `nx init` should work correctly, and proper feedback should be
printed to the user if it can't determine the compatibility of the
Angular version. It should correctly resolve the `@angular/core` package
from the Angular CLI workspace root.

## Related Issue(s)

Fixes #31291

(cherry picked from commit cb930d0)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 9, 2025

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npx nx@latest init --integrated on a fresh angular app does nothing

2 participants