fix(core): improve error for setting an internal node as an external … (#27102)
…dependency <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> A unhelpful error is thrown when someone specifies a local project as an external dependency input. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> A helpful error is thrown when someone specifies a local projecft as an external dependency input. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes https://github.com/nrwl/nx/issues/27088
This commit is contained in:
parent
28cd0c4eef
commit
fc1ad39fa2
@ -167,7 +167,16 @@ impl HashPlanner {
|
||||
let external_node_name =
|
||||
find_external_dependency_node_name(dep, &self.project_graph);
|
||||
let Some(external_node_name) = external_node_name else {
|
||||
anyhow::bail!("The externalDependency '{dep}' for '{project_name}:{target_name}' could not be found")
|
||||
if self.project_graph.nodes.contains_key(dep) {
|
||||
let deps = self.project_graph.dependencies.get(project_name);
|
||||
if deps.is_some_and(|deps| deps.contains(dep)) {
|
||||
anyhow::bail!("The externalDependency '{dep}' for '{project_name}:{target_name}' is not an external node and is already a dependency. Please remove it from the externalDependency inputs.")
|
||||
} else {
|
||||
anyhow::bail!("The externalDependency '{dep}' for '{project_name}:{target_name}' is not an external node. If you believe this is a dependency, add an implicitDependency to '{project_name}'")
|
||||
}
|
||||
} else {
|
||||
anyhow::bail!("The externalDependency '{dep}' for '{project_name}:{target_name}' could not be found")
|
||||
}
|
||||
};
|
||||
trace!(
|
||||
"Add External Instruction for External Input {external_node_name}: {}",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user