Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions crates/turborepo-engine/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -667,16 +667,25 @@ impl<'a, L: TurboJsonLoader> EngineBuilder<'a, L> {
}
}

if task_definitions.is_empty() && self.should_validate_engine {
let (span, text) = task_id.span_and_text("turbo.json");
return Err(BuilderError::MissingPackageTask(Box::new(
MissingPackageTaskError {
span,
text,
task_id: task_id.to_string(),
task_name: task_name.to_string(),
},
)));
if task_definitions.is_empty() {
let has_script_in_package_json = self
.package_graph
.package_json(&package_name)
.is_some_and(|pkg_json| pkg_json.scripts.contains_key(task_name.task()));

if has_script_in_package_json {
task_definitions.push(ProcessedTaskDefinition::default());
} else if self.should_validate_engine {
let (span, text) = task_id.span_and_text("turbo.json");
return Err(BuilderError::MissingPackageTask(Box::new(
MissingPackageTaskError {
span,
text,
task_id: task_id.to_string(),
task_name: task_name.to_string(),
},
)));
}
}

Ok(task_definitions)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "root-tasks",
"scripts": {
"test": "echo 'root test'"
},
"workspaces": [
"workspace-a",
"workspace-b"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"tasks": {
"dev": {
"dependsOn": [
"workspace-a#build:openapi"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "workspace-a",
"scripts": {
"build:openapi": "echo 'build:openapi workspace-a'"
},
"dependencies": {
"workspace-b": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "workspace-b",
"scripts": {
"build": "echo 'build workspace-b'"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Setup
$ . ${TESTDIR}/../../../helpers/setup_integration_test.sh task_dependencies/repro-10516

Test reproduction of issue 10516
$ ${TURBO} run dev --graph

digraph {
compound = "true"
newrank = "true"
subgraph "root" {
" workspace-a#build:openapi" -> " ___ROOT___"
" workspace-a#dev" -> " workspace-a#build:openapi"
" workspace-b#dev" -> " workspace-a#build:openapi"
}
}