-
Notifications
You must be signed in to change notification settings - Fork 12k
bug: not generate files to the defaultProject #11111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A few of us are seeing this error after the fix for the CLI ignoring sourceRoot: #10653 (comment) Thanks to @darinclark for finding a workaround. It appears to just grab the last project in your angular.json. So if you have a main project and then a e2e project, reorder them so the main project is last and your default generate commands will go to the main project instead of e2e. If you need to generate something to the e2e project then you can use the |
just pinging to say that I faced the issue with the same angular and angular-cli versions as @rfuhrer and @darinclark workaround works. Just curious to know if the error may be in the generation of angular.json or on the cli itself |
This problem seems to happen only when an angular app is updated using There are a bit different configurations generated with The noticeable difference that I see and could cause this problem is that:
Here are the complete files for reference:
and
|
This might have a similar root cause as #11321 |
The reason they are created to the project you were not expecting, is because they are being run in the directory of the initial project. The logic to determine the project:
In this case (and the default case) the root of the initial project is |
What we'd like to do is:
|
We have decided to standardize on the model where the default application goes in the root of the workspace, next to the For novice/intermediate users, we suggest that users simply run "ng new" again to get a separate application in a separate workspace. The "monorepo" use case, where you want multiple applications/libraries to live together in one workspace, will continue to be supported for advanced users. Note that the workflow |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Versions
Repro steps
ng new test-proj ng g application test-app // edit angular.json defaultProject -> test-app ng g c test-comp CREATE src/app/test-comp/test-comp.component.css (0 bytes) CREATE src/app/test-comp/test-comp.component.html (28 bytes) CREATE src/app/test-comp/test-comp.component.spec.ts (643 bytes) CREATE src/app/test-comp/test-comp.component.ts (280 bytes) UPDATE src/app/app.module.ts (406 bytes)
Observed behavior
ref: #10352 , #10327
cli always generate schematics (pwa,component...) to the project under src/ folder
Desired behavior
please consider using the defaultProject for single project command like ng generate, ng add... I'm still experiencing the generated files go into the project under src/ folder instead of the project under projects/defaultProject/src/
Mention any other details that might be useful (optional)
I also see an regression that the generated component nolonger be added to the nearest NgModule, but always be added to the app.module.ts. Should I create another issue for that?
The text was updated successfully, but these errors were encountered: