-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(js): handle workspace packages when nx.name differs from package.json.name #33583
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
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
View your CI Pipeline Execution ↗ for commit 65ae1e2
☁️ Nx Cloud last updated this comment at |
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.
Nx Cloud has identified a possible root cause for your failed CI:
Our PR changes fix workspace package handling in the prune-lockfile executor, which has no code path connection to the Storybook serve operation. The e2e test failure is due to a test infrastructure issue where the expected regex pattern /Storybook.*started/gi doesn't match the actual Storybook v10.1.7 output "Storybook ready!", causing a timeout despite Storybook successfully starting.
No code changes were suggested for this issue.
If the issue was transient, you can trigger a rerun by pushing an empty commit:
git commit --allow-empty -m "chore: trigger rerun"
git push
🎓 Learn more about Self-Healing CI on nx.dev
…json.name Fix addNodesAndDependencies to correctly retrieve workspace nodes from workspacePackages map instead of graph.nodes when handling workspace dependencies. This ensures transitive dependencies are included even when the project's nx.name differs from its package.json.name. Fixes nrwl#33582
3c8ca2f to
65ae1e2
Compare
…json.name (#33583) ## Current Behavior <!-- This is the behavior we have today --> When a workspace library has a `name` field set in its `nx` configuration (e.g., `"nx": { "name": "buildable" }`), the `@nx/js:prune-lockfile` executor fails to include transitive dependencies from that library in the pruned lockfile. The issue occurs because `addNodesAndDependencies` attempts to retrieve workspace nodes using `graph.nodes[name]` where `name` is the package name from `package.json`, but `graph.nodes` is keyed by the project name (from `nx.name`). When these differ, the lookup fails and transitive dependencies are not traversed. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The `@nx/js:prune-lockfile` executor should include all transitive dependencies from workspace libraries regardless of whether the library has a `name` field set in its `nx` configuration. The fix uses the workspace node from the `workspacePackages` map (which is keyed by package name) instead of attempting to look it up in `graph.nodes` (which is keyed by project name). ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #33582 (cherry picked from commit 30e6f85)
…json.name (#33583) ## Current Behavior <!-- This is the behavior we have today --> When a workspace library has a `name` field set in its `nx` configuration (e.g., `"nx": { "name": "buildable" }`), the `@nx/js:prune-lockfile` executor fails to include transitive dependencies from that library in the pruned lockfile. The issue occurs because `addNodesAndDependencies` attempts to retrieve workspace nodes using `graph.nodes[name]` where `name` is the package name from `package.json`, but `graph.nodes` is keyed by the project name (from `nx.name`). When these differ, the lookup fails and transitive dependencies are not traversed. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The `@nx/js:prune-lockfile` executor should include all transitive dependencies from workspace libraries regardless of whether the library has a `name` field set in its `nx` configuration. The fix uses the workspace node from the `workspacePackages` map (which is keyed by package name) instead of attempting to look it up in `graph.nodes` (which is keyed by project name). ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #33582
|
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
When a workspace library has a
namefield set in itsnxconfiguration (e.g.,"nx": { "name": "buildable" }), the@nx/js:prune-lockfileexecutor fails to include transitive dependencies from that library in the pruned lockfile.The issue occurs because
addNodesAndDependenciesattempts to retrieve workspace nodes usinggraph.nodes[name]wherenameis the package name frompackage.json, butgraph.nodesis keyed by the project name (fromnx.name). When these differ, the lookup fails and transitive dependencies are not traversed.Expected Behavior
The
@nx/js:prune-lockfileexecutor should include all transitive dependencies from workspace libraries regardless of whether the library has anamefield set in itsnxconfiguration.The fix uses the workspace node from the
workspacePackagesmap (which is keyed by package name) instead of attempting to look it up ingraph.nodes(which is keyed by project name).Related Issue(s)
Fixes #33582