-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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): fix handling of simple dependsOn target string #16932
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
This makes sense to me, thanks for the contribution 🎉
Can you add a unit test and address the change I requested?
if (!segments.length) { | ||
return { target: maybeProject }; | ||
} |
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.
if (!segments.length) { | |
return { target: maybeProject }; | |
} | |
if (segments.length == 1) { | |
return { target: maybeProject }; | |
} |
This condition as written would never be hit, since there is always at least 1 segment (that just happens to be the target name most of the time).
It's OK IMHO to assume it's a target name when only one segment is present, so updating the condition like above should suffice.
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.
@AgentEnder I think this code is correct as written - a couple lines above there's the [maybeProject, ...segments] = splitByColons(targetString)
line. Unless I'm misunderstanding how the split function works, it seems that segments does have the possibility to be empty 🤔
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.
Also for what it's worth - I tested the change as I originally wrote it in my monorepo (via patch-package
) and it did fix the issue I was experiencing.
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.
Ah, yes. That's what I get for checking on my phone!
Thanks for the contribution!
closes nrwl#16931 - if a project has a `dependsOn` string with only a target that has the same name as another project, it is now treated correctly as a reference to a target in the same project
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. |
Fixes #16931
dependsOn
string with only a target that has the same name as another project, it is now treated correctly as a reference to a target in the same projectThis was the simplest approach I could think of to fix the issue and ensure the functionality remains the same as is currently documented.