-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
In multi-project workspace, the inject migration doesn't work when targeting one of the projects due to either not finding any files in other projects or considering them external thus it throws a SchematicsException
Minimal Reproduction
- Create a new workspace with Angular CLI
a.ng new my-workspace --no-create-application - Generate a new application in the workspace
a.ng generate application my-app - Generate a new library in the workspace
a.ng generate library my-lib - Create a new service
- Import service into generated component in
my-lib - Run inject migration targeting the library
a.ng generate @angular/core:inject --path=./projects/my-lib/src
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-ap2u31fu
Please provide the exception or error you saw
`Could not find any files to migrate under the path \\home\\projects\\stackblitz-starters-ap2u31fu\\projects\\my-lib\\src. Cannot run the inject migration.`
Please provide the environment you discovered this bug in (run ng version)
Angular CLI : 21.0.3
Angular : 21.0.5
Node.js : 20.19.1
Package Manager : npm 10.8.2
Operating System : linux x64
Package Version
------------------------------------------------
@angular/build 21.0.3
@angular/cli 21.0.3
@angular/common 21.0.5
@angular/compiler 21.0.5
@angular/compiler-cli 21.0.5
@angular/core 21.0.5
@angular/forms 21.0.5
@angular/platform-browser 21.0.5
@angular/router 21.0.5
ng-packagr 21.0.0
rxjs 7.8.2
typescript 5.9.3
vitest 4.0.15
Anything else?
I couldn't find any information if this multi-project scenario are supported by migrations so I'm not sure if this is a bug or not.
One thing I noticed is that in the source code the exception is thrown if no files are found, so maybe a naïve fix could be just rendering a warning but continue to the next tsconfig file so that the whole migration process isn't interrupted (however it might still ignores due to the external library check)
Alternatives considered
In a similar but now deprecated migration made by @eneajaho in the ngxtension project it contains a --project flag which could be a nice solution
https://ngxtension.dev/utilities/migrations/inject-migration/#options