-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(ng-update): properly handle update from different working directory #19933
fix(ng-update): properly handle update from different working directory #19933
Conversation
In some situations, developers will run `ng update` from a sub directory of the project. This currently results in a noop migration as file system paths were computed incorrectly. This is because ng-update always assumed that the CWD is the workspace root in the real file system. This is not the case and therefore threw off path resolution. We can fix this by determining the workspace file system path from the virtual file system host tree's. This is not ideal, but best solution for now until we can parse/resolve TypeScript projects purely from within the virtual file system. This is currently not easy to implement and requires helpers from TS which are not exposed yet. See: microsoft/TypeScript#13793. This is tracked with: COMP-387. Fixes angular#19779.
if (!(tree.root instanceof HostDirEntry)) { | ||
return null; | ||
} | ||
const hostTree = tree.root['_tree']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment about this private accesses in this function?
* Gets the workspace file system path from the given tree. Returns | ||
* `null` if the path could not be determined. | ||
*/ | ||
// TODO: Remove this once we have a fully virtual TypeScript compiler host: COMP-387 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the TODO should go above the JsDoc block
Thanks for reviewing. I went ahead and made the long-term changes that we need anyway in framework too, rather than fiddling more around with the non-ideal tricks to get the TS compiler API work for schematics. See: #19934 |
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. |
In some situations, developers will run
ng update
from a sub directoryof the project. This currently results in a noop migration as file
system paths were computed incorrectly. This is because ng-update
always assumed that the CWD is the workspace root in the real file
system. This is not the case and therefore threw off path resolution.
We can fix this by determining the workspace file system path from
the virtual file system host tree's. This is not ideal, but best
solution for now until we can parse/resolve TypeScript projects
purely from within the virtual file system. This is currently
not easy to implement and requires helpers from TS which are
not exposed yet. See: microsoft/TypeScript#13793.
This is tracked with: COMP-387.
Fixes #19779.