-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(devkit): include UPDATE changes in findCreatedProjectFiles for generator callbacks #31429
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
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Pull Request Overview
This PR fixes an issue in generator callbacks by modifying the logic to include both CREATE and UPDATE file changes when detecting newly created project files, and prevents duplicates by using deduplication with a Set. It also adds a comprehensive test to validate that project configurations created during generator callbacks are correctly returned by getProjects.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
packages/nx/src/generators/utils/project-configuration.ts | Modified findCreatedProjectFiles to include UPDATE changes and added deduplication logic to avoid duplicates. |
packages/nx/src/generators/utils/project-configuration.spec.ts | Added a new test case to verify project detection when files are marked as UPDATE in generator callbacks. |
View your CI Pipeline Execution ↗ for commit 1979513
☁️ Nx Cloud last updated this comment at |
a789a09
to
7013a8c
Compare
…nerator callbacks During generator callbacks, the tree has already applied changes, so newly created project files are marked as UPDATE instead of CREATE. This caused getProjects() to miss projects created during the generator run when called from callbacks. Changes: - Modified findCreatedProjectFiles() to include both CREATE and UPDATE changes - Added deduplication using Set to prevent duplicate project files - Added test coverage for the callback scenario Fixes #29852 Co-authored-by: AgentEnder <[email protected]>
7013a8c
to
1979513
Compare
…nerator callbacks (#31429) ## Current Behavior getProjects(Tree) from project-configuration.ts does not return projects created in generators when called from generator callbacks. This happens because findCreatedProjectFiles only looks for changes with type === 'CREATE', but during callbacks, the tree has already been flushed to disk, so newly created project files are marked as 'UPDATE' instead of 'CREATE'. ## Expected Behavior getProjects(Tree) should return all projects, including those created during the current generator run, even when called from generator callbacks. ## Changes Made - Modified findCreatedProjectFiles() to include both CREATE and UPDATE changes - Added deduplication using Set to prevent duplicate project files - Added comprehensive test coverage for the callback scenario ## Related Issue(s) Fixes #29852 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: AgentEnder <[email protected]> (cherry picked from commit d298de5)
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. |
Current Behavior
getProjects(Tree) from project-configuration.ts does not return projects created in generators when called from generator callbacks. This happens because findCreatedProjectFiles only looks for changes with type === 'CREATE', but during callbacks, the tree has already been flushed to disk, so newly created project files are marked as 'UPDATE' instead of 'CREATE'.
Expected Behavior
getProjects(Tree) should return all projects, including those created during the current generator run, even when called from generator callbacks.
Changes Made
Related Issue(s)
Fixes #29852
🤖 Generated with Claude Code