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

[BUG] Project is being captured as a dependency even though it is not #125

Closed
pemsbr opened this issue Sep 22, 2021 · 6 comments · Fixed by #143
Closed

[BUG] Project is being captured as a dependency even though it is not #125

pemsbr opened this issue Sep 22, 2021 · 6 comments · Fixed by #143
Assignees
Labels
bug Something isn't working needs-triage This issue has yet to be looked over by a core team member outdated

Comments

@pemsbr
Copy link
Contributor

pemsbr commented Sep 22, 2021

Describe the bug
A project is wrongly captured as a dependency when it starts with the same name as a project that is actually a dependency.

To Reproduce
Steps to reproduce the behavior:

  1. Create 3 projects (dep-project, dep-project-foo, target-project)
    libs/
    ├─ target-project/TargetProject.csproj
    ├─ dep-project-foo/DepProject.Foo.csproj
    ├─ dep-project/DepProject.csproj

  2. Add dep-project-foo as a project reference in target-project

  3. Run nx dep-graph

  4. Not only is dep-project-foo a dependency of target-project but also dep-project

Expected behavior
target-project should only have one dependency: dep-project-foo

Additional context
I think the problem is here:

if (workspaceFilePath.startsWith(path)) {

Comparing against `${path}\\` appears to fix the issue.

@pemsbr pemsbr added bug Something isn't working needs-triage This issue has yet to be looked over by a core team member labels Sep 22, 2021
@AgentEnder
Copy link
Member

Yikes, yeah thats valid. I'd prefer something like this to make sure it doesn't break across OS's

import {normalizePath} from '@nrwl/devkit'
...
  if (normalizePath(workspaceFilePath).startsWith(`${path}/`)
...

@pemsbr Are you interested in putting a PR in for this? I can assign it to you if so 😄

@pemsbr
Copy link
Contributor Author

pemsbr commented Sep 22, 2021

Sure, I can pick it up 👍

@pemsbr
Copy link
Contributor Author

pemsbr commented Sep 22, 2021

I don't seem to have permissions to push my branch with the fix and create the PR

@AgentEnder
Copy link
Member

You'll need to fork it and push your branch there to create the PR, this gist seems to document that flow well

https://gist.github.com/Chaser324/ce0505fbed06b947d962

There's a discussion thread that details how to test your changes locally somewhere around here.

pemsbr added a commit to pemsbr/nx-dotnet that referenced this issue Sep 22, 2021
AgentEnder added a commit that referenced this issue Sep 27, 2021
fix(core): projects w/ similar names should not be picked up as affected by change to one project.

Closes #125

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

Co-authored-by: Pedro Rodrigues <4513618+pemsbr@users.noreply.github.com>
github-actions bot pushed a commit that referenced this issue Sep 27, 2021
## [1.4.2](v1.4.1...v1.4.2) (2021-09-27)

### Bug Fixes

* use exact project paths ([#143](#143)) ([7a3c5e9](7a3c5e9)), closes [#125](#125)

Sep 27, 2021, 4:30 PM
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 1.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working needs-triage This issue has yet to be looked over by a core team member outdated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants