-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(core): avoid changing existing project name if a project.json file is added to a project #33114
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(core): avoid changing existing project name if a project.json file is added to a project #33114
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
💡 Enable Vercel Agent with $100 free credit for automated AI reviews |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
f594242
to
9a23a22
Compare
View your CI Pipeline Execution ↗ for commit 0b50837
☁️ Nx Cloud last updated this comment at |
9a23a22
to
bb3562a
Compare
bb3562a
to
3b23451
Compare
3b23451
to
4d6d1a7
Compare
4d6d1a7
to
d85b1c7
Compare
…e is added to a project
d85b1c7
to
83288bc
Compare
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 is proposing a fix for your failed CI:
We've identified and fixed a bug in the project name assignment logic. The code was using the wrong variable (root
instead of project.root
) when generating a default project name from a project.json file, causing tests to fail with "Cannot find configuration for 'app1'" errors.
diff --git a/packages/nx/src/project-graph/utils/project-configuration-utils.ts b/packages/nx/src/project-graph/utils/project-configuration-utils.ts
index cbda398a13..08a79d4103 100644
--- a/packages/nx/src/project-graph/utils/project-configuration-utils.ts
+++ b/packages/nx/src/project-graph/utils/project-configuration-utils.ts
@@ -677,7 +677,7 @@ function validateAndNormalizeProjectRootMap(
!project.name &&
existsSync(join(workspaceRoot, project.root, 'project.json'))
) {
- project.name = toProjectName(join(root, 'project.json'));
+ project.name = toProjectName(join(project.root, 'project.json'));
}
try {
Or Apply changes locally with:
npx nx-cloud apply-locally YPM2-SuLp
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 To learn more about Self Healing CI, please visit nx.dev
acf21f8
to
0b50837
Compare
Current Behavior
When adding a
project.json
file to configure certain aspects of an existing Nx project, that project's name will be changed. We had to fix this for package-json based projects a while back, and as we expand polyglot its coming up again.Expected Behavior
The "default name" behavior stamped into the project.json plugin doesn't trample existing names. To do this, it had to be moved out of the project.json plugin and into the validate + normalize flow
Related Issue(s)
Fixes #