Skip to content

fix(core): update getTouchedProjectsFromLockFile to handle deleted/moved projects correctly #31361

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

laneysmith
Copy link
Contributor

@laneysmith laneysmith commented May 27, 2025

Current Behavior

This fixes a case that was not handled in #31091.

Currently, for pnpm projects with 'projectsAffectedByDependencyUpdates': 'auto', when a project is deleted from the workspace or moved to a different directory, it is added to the getTouchedProjectsFromLockFile list as undefined. This results in the following error when you run commands that calculate affected projects:

Error: Invalid project name is detected: "undefined"
    at addAffectedNodes ...

Expected Behavior

getTouchedProjectsFromLockFile should only return project names for existing projects.
Because the changedProjectPaths entry for deleted/moved projects will not map to a project in the projectGraphNodes object, we should filter them out of the getProjectsNamesFromPaths result.

Related Issue(s)

None that I'm aware of.


I spent some time trying to debug the failing nx release version plans › should pick new versions based on version plans using programmatic api e2e test and am not seeing how my changes could have caused the TypeError: yargs.version is not a function failure. 😕 I'd appreciate some help debugging that one! 🙏

Copy link

vercel bot commented May 27, 2025

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

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview May 27, 2025 11:07pm

@laneysmith laneysmith changed the title fix(core): update getTouchedProjectsFromLockFile to handle deleted pr… fix(core): update getTouchedProjectsFromLockFile to handle deleted/move projects correctly May 27, 2025
Copy link

nx-cloud bot commented May 27, 2025

View your CI Pipeline Execution ↗ for commit 7297f82.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 7m 46s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 17s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 1m 9s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-27 23:19:15 UTC

@laneysmith laneysmith changed the title fix(core): update getTouchedProjectsFromLockFile to handle deleted/move projects correctly fix(core): update getTouchedProjectsFromLockFile to handle deleted/moved projects correctly May 27, 2025
@laneysmith laneysmith force-pushed the laneys/fix-pnpm-projects-affected-by-dependency-updates branch 3 times, most recently from f847f74 to d8a205d Compare May 27, 2025 20:04
@laneysmith laneysmith force-pushed the laneys/fix-pnpm-projects-affected-by-dependency-updates branch from d8a205d to 7297f82 Compare May 27, 2025 23:05
@laneysmith laneysmith marked this pull request as ready for review May 28, 2025 01:14
@laneysmith laneysmith requested a review from a team as a code owner May 28, 2025 01:14
@laneysmith laneysmith requested a review from MaxKless May 28, 2025 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant