fix(angular): handle newProjectRoot correctly when generating apps and libs #9255
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Behavior
In workspaces where the
newProjectRoot
config might be specified in theangular.json
(v1 format), there are issues creating applications and libraries. The@schematics/angular:application
or@schematics/angular:library
generator use that property if present to create the projects and then, the@nrwl/*
generators move the projects to the final destination.Most workspaces won't have this issue since that option doesn't get generated in new Nx workspaces and it gets deleted when migrating an Angular CLI workspace to an Nx workspace. However, if an Angular CLI workspace is migrated preserving the Angular CLI layout, the option is not meant to be removed and therefore it still needs to be handled correctly. In that scenario, the Angular CLI schematics need to work as usual, and for that, the option needs to be present.
A recent PR #8865 made a change to always remove the option when updating the configuration which is not something desired when a workspace preserves the Angular CLI layout.
Expected Behavior
In workspaces where the
newProjectRoot
option is set in the configuration, the@nrwl/angular:app
and@nrwl/angular:lib
should handle it and work correctly. ThenewProjectRoot
option shouldn't be deleted when updating the configuration if it's not meant to be deleted.Related Issue(s)
Fixes #