Skip to content
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(angular): use sync host when generating code with angular cli schematics #15137

Conversation

leosvelperez
Copy link
Member

Current Behavior

Generating code with Angular CLI schematics throw Expected a synchronous delegate but got an asynchronous one. That error is handled in some cases, but it's not reliable and can't handle all scenarios. The host provided by the Angular CLI adapter has some async methods while the Angular DevKit expects them to be synchronous. This is a regression introduced in 15.7.0.

Expected Behavior

Generating code with Angular CLI schematics should work correctly.

Related Issue(s)

Fixes #15124

@leosvelperez leosvelperez self-assigned this Feb 20, 2023
@vercel
Copy link

vercel bot commented Feb 20, 2023

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

Name Status Preview Comments Updated
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 20, 2023 at 5:57PM (UTC)

Copy link
Member

@AgentEnder AgentEnder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, left a question

Comment on lines -506 to +509
const fsHost = new NxScopedHost(root);
const fsHost = new NxScopeHostUsedForWrappedSchematics(
root,
new FsTree(root, verbose)
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the original NxScopedHost still used anywhere? Maybe we can remove it and only keep the sync implementation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's used for executors. The read operation is faster using the project graph and executors don't write back. So there's no issue with the async write implementation. That said, I plan to refactor/rename our existing host implementations, so they better represent what they are for. I'll do it in a follow-up PR later.

@github-actions
Copy link

github-actions bot commented Mar 3, 2023

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 Mar 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants